On 4/20/10 11:54 PM, Iain Duncan wrote:
> Hi folks, I noticed that in the new version of the BFGAlchemy sample
> app, the transaction manager is used to clear out the session after the
> transaction is done. I'm wondering whether there is anything wrong with
> cleaning the session by call Session.remove() in the INewRequest
> subscriber directly ( I'm not using repoze.tm <http://repoze.tm>, yet! )
> and having it do so at the beginning of each request instead of at the end.

That might work.  There's also an INewResponse event that could be used.  The 
only potential problem is that if later you do start to use the transaction 
middleware, you'll want it to be responsible for cleaning up the session after 
a commit, because if you remove the session before it has a chance to commit, 
it won't be able to commit.  But that will probably be an obvious problem to go 
find and fix if that time ever comes, so you can do the needful in the meantime.

Chris McDonough
Agendaless Consulting, Fredericksburg VA
The repoze.bfg Web Application Framework Book: http://bfg.repoze.org/book
Repoze-dev mailing list

Reply via email to