Skip to content

Commit

Permalink
Merge pull request #8 from sirn/master
Browse files Browse the repository at this point in the history
Data manager's should_retry did not get called
  • Loading branch information
mmerickel committed Feb 12, 2013
2 parents 228ff03 + 8633062 commit e8fc3cf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyramid_tm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ def tm_tween(request):
except:
exc_info = sys.exc_info()
try:
manager.abort()
retryable = manager._retryable(*exc_info[:-1])
manager.abort()
if (number <= 0) or (not retryable):
reraise(*exc_info)
finally:
Expand Down
10 changes: 7 additions & 3 deletions pyramid_tm/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def setUp(self):
self.request = DummyRequest()
self.response = DummyResponse()
self.registry = DummyRegistry()

def _callFUT(self, handler=None, registry=None, request=None, txn=None):
if handler is None:
def handler(request):
Expand Down Expand Up @@ -114,7 +114,7 @@ class Conflict(TransientError):
def handler(request, count=count):
raise Conflict
self.assertRaises(Conflict, self._callFUT, handler=handler)

def test_handler_isdoomed(self):
txn = DummyTransaction(True)
self._callFUT(txn=txn)
Expand Down Expand Up @@ -236,13 +236,15 @@ def __init__(self, doomed=False, retryable=False):
self.committed = 0
self.aborted = 0
self.retryable = retryable
self.active = False

@property
def manager(self):
return self

def _retryable(self, t, v):
return self.retryable
if self.active:
return self.retryable

def get(self):
return self
Expand All @@ -255,12 +257,14 @@ def isDoomed(self):

def begin(self):
self.began+=1
self.active = True
return self

def commit(self):
self.committed+=1

def abort(self):
self.active = False
self.aborted+=1

def note(self, value):
Expand Down

0 comments on commit e8fc3cf

Please sign in to comment.