On Thu, 2011-03-31 at 16:49 +0100, Chris Withers wrote: > On 31/03/2011 16:09, Chris Withers wrote: > > What's the preferred way of working with transactions now, be they just > > SQLAlchemy transactions or, more likely, a bunch of things tied together > > by a transaction from the 'transaction' package? > > > > repoze.tm2 seems to be the "old skool" BFG way of doing things, but is > > this still the "right" way in Pyramid? > > > > The templates/scaffolds certainly use repoze.tm2, but the book uses the > > transaction package as an example for "Using Finished Callbacks". What > > are the differences between these two approaches? > > Trying to answer this myself: > > So, repoze.tm2 has the following features missing from the simple > example in "Using Finished Callbacks": > > - commit veto: what situations would request.exception be None but the > response status start with '4' or '5'? > > - after_end cleanups: but, I guess these could just be passed to > add_finished_callback, right? FWIW, doesn anyone have any real-world > examples where they've needed to use after_end cleanups? > > - isDoomed support: I guess this could be added to the example; can > someone explain when isDoomed is True and what happens if that > transaction is committed instead of being manually aborted? > > If I understand the above correctly (hopefully someone will point out if > I missed anything!) then a simple Finished Callback should suffice, right? > > > Related: Any chance of a RequestFinished event to subscribe to rather > > than having to (rather convolutedly) subscribe to NewRequest just so > > your handler can call add_finished_callback? > > ...in which case, I'd dearly love that RequestFinished event!
Rocky has already created http://docs.pylonsproject.org/projects/pyramid_tm/dev/ which is an alternative to repoze.tm2 that uses a finished callback instead of middleware. I don't know if it solves the problem you're having. - C -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To post to this group, send email to pylons-devel@googlegroups.com. To unsubscribe from this group, send email to pylons-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-devel?hl=en.