Commit 4d149fb5 authored by Jeremy Hylton's avatar Jeremy Hylton

Fix bug in last-minute revision: Can't rebind retries in g().

parent b7378d61
...@@ -36,20 +36,21 @@ def transact(f, note=None, retries=5): ...@@ -36,20 +36,21 @@ def transact(f, note=None, retries=5):
# XXX deal with ZEO disconnected errors? # XXX deal with ZEO disconnected errors?
def g(*args, **kwargs): def g(*args, **kwargs):
while retries: n = retries
retries -= 1 while n:
n -= 1
try: try:
r = f(*args, **kwargs) r = f(*args, **kwargs)
except ReadConflictError, msg: except ReadConflictError, msg:
get_transaction().abort() get_transaction().abort()
if not retries: if not n:
raise raise
continue continue
try: try:
_commit(note) _commit(note)
except ConflictError, msg: except ConflictError, msg:
get_transaction().abort() get_transaction().abort()
if not retries: if not n:
raise raise
continue continue
return r return r
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment