Hi,

I am upgrading some old code of mine, and I came across the
request.db (I think it's called request.session in Pyramid scaffolding)
method which looks like:

def db(request):
session = request.registry.sessionmaker()

def cleanup(request):
session.close()
request.add_finished_callback(cleanup)
return session

and calling config.add_request_method(db, reify=True) somewhere, while the
sessionmaker was called with ZopeTransactionExtension.

The "current" version is something like:
def db(request):
session = request.registry.sessionmaker()
zope.sqlalchemy.register(session, transaction_manager=request.tm)
return session

Now, I wonder. I expect that pyramid_tm takes care of the cleanup /
session.close()
for the request. But I have always used the transaction manager pyramid_tm.
Am I
guessing correctly, that adding finished callback(cleanup) was unnecessary?

Thanks...
Petr
-- 
https://blahos.com/
https://traceability.cz/

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CA%2ByMeXWHgTrt%3DTHkK-fgAcdjxxpqe3nQkuy1RBg4ziM61Axazg%40mail.gmail.com.

Reply via email to