kudos...

Chris McDonough <[email protected]>
Newsgroups gmane.comp.web.zope.devel
Message-ID <1312836275.24555.72.camel@thinko>
Kudos to whomever turned the "transaction" package's transaction manager
into a context manager and was thoughtful enough to provide the
"attempts" method (which returns a separate context manager, wrapping
the txn context manager, and retries some number of configurable times).
This makes writing code that integrates with a web system that commits
or aborts as easy as:

         import transaction

         for attempt in transaction.attempts(attempts):
            with attempt as t:
                response = handler(request)

                if t.isDoomed():
                    t.abort()

                if commit_veto is not None:
                    veto = commit_veto(request, response)
                    veto and t.abort()

                return response

Very nice.

- C


_______________________________________________
Zope-Dev maillist  -  [email protected]
https://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope )
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.