I use a reified request property to create the SqlAlchemy session. The factory function adds an "add_finished_callback" to close the session. (Why don't you have access to the request?)
On Wed, Apr 6, 2016 at 11:30 AM, Jonathan Vanasco <jonat...@findmeon.com> wrote: > A few routes I have need to explicitly commit the session, and require me > to use "long lasting sessions" ( > https://pypi.python.org/pypi/zope.sqlalchemy#long-lasting-session-scopes) > > Since this disables transaction's call to "close" on commit, what is the > best way to close the SqlAlchemy session? > > I ended up using a Tween, but my first thought was to use > "add_finished_callback" (but there was only a config object, not a request > object). > > -- > You received this message because you are subscribed to the Google Groups > "pylons-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pylons-devel+unsubscr...@googlegroups.com. > To post to this group, send email to pylons-devel@googlegroups.com. > Visit this group at https://groups.google.com/group/pylons-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at https://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/d/optout.