[ZODB-Dev] transaction "Attempts" class
Jim Fulton
jim at zope.com
Wed Mar 28 18:21:19 UTC 2012
On Wed, Mar 28, 2012 at 2:11 PM, Zvezdan Petkovic <zvezdan at computer.org> wrote:
...
Thanks for chiming in Zvezdan. I was hoping you would. :)
We should fix this if we can. If I could do over, I'd have a different
API that uses a function rather than a block and was designed to work
as a decorator. Something like:
@transaction.job
def doit(tx):
...
where doit would, hopefully, be descriptive.
You's also be able to:
@transaction.job(retry_limit=5)
def doit(tx):
...
As a bonus, I'd automatically set a transaction note with the function
name or first line of doc string, and the retry #.
I do plan to do this, um, when I get around to it. Might be a nice
small project for someone who wants to contribute.
The with statement is really wanting when you might want to execute
code other than once.
Jim
--
Jim Fulton
http://www.linkedin.com/in/jimfulton
More information about the ZODB-Dev
mailing list