On Wed, Mar 28, 2012 at 2:11 PM, Zvezdan Petkovic <[email protected]> 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
_______________________________________________
For more information about ZODB, see http://zodb.org/
ZODB-Dev mailing list - [email protected]
https://mail.zope.org/mailman/listinfo/zodb-dev