jason kirtland wrote:
On Wed, Apr 28, 2010 at 7:52 AM, Chris Withers <ch...@simplistix.co.uk> wrote:
Diana Clarke wrote:
Finally, we're using pylons and are removing the contextual session in the
finally clause of the base controller's __call__ method.

class BaseController(WSGIController):

   def __call__(self, environ, start_response):
       try:
           ...
       finally:
           session.remove()
Yeah, I'm trying to find out if this .remove() is actually necessary.

.remove() as the final operation in a request ensures that no session
state leaks from one web request to another. The next request in that
thread or scoping context will get an entirely fresh session to work
with.

Okay, would .close() be equivalent here?

If finishing with a .remove() is a big deal in your environment, which
it seems like it is, you could do a .remove() at the start of the
request instead.

What happens if you call .remove() on a virgin session?

cheers,

Chris

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to