##// END OF EJS Templates
transaction: turn a transaction into a Python context manager...
Bryan O'Sullivan -
r27862:b2145c19 default
parent child Browse files
Show More
@@ -333,6 +333,14 b' class transaction(object):'
333 if self.count > 0 and self.usages == 0:
333 if self.count > 0 and self.usages == 0:
334 self._abort()
334 self._abort()
335
335
336 def __enter__(self):
337 return self
338
339 def __exit__(self, exc_type, exc_val, exc_tb):
340 if exc_type is None:
341 self.close()
342 self.release()
343
336 def running(self):
344 def running(self):
337 return self.count > 0
345 return self.count > 0
338
346
General Comments 0
You need to be logged in to leave comments. Login now