Previously Michael Bayer wrote: > On Jun 27, 6:42 pm, Ian Bicking <[EMAIL PROTECTED]> wrote: > > The way I see this working is something like (vaguely): > > > > def transaction_middleware(app): > > def wrapper(environ, start_response): > > manager = TransactionManager() > > environ['transaction.manager'] = manager > > try: > > app_iter = app(environ, start_response) > > except: > > manager.rollback() > > raise > > else: > > manager.commit() > > > > The manager is basically a container of *actual* transactions, and > > calling rollback or commit on it gets passed on to all the transactions > > in the manager. > > this is fine. we're *really* starting to imitate J2EE in some ways. > but its not a bad thing.
For what it's worth: Zope has a similar structure. The Zope publisher starts a transaction when it receives a request and commits it when the request processing has finished, unless an exception has been thrown or someone did an explicit rollback. Rollback tends to be very rare so it seems that it is not very useful to optimize for that case. The Zope machinery allows you to add your own commit/rollback hooks, which is used to tie SA into Zope. Wichert. -- Wichert Akkerman <[EMAIL PROTECTED]> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en -~----------~----~----~----~------~----~------~--~---