Make rollback conditional on db.dirty

avoids calling rollback when there are no changes

includes warning about what objects are actually dirty
This commit is contained in:
Min RK
2017-07-24 12:53:58 +02:00
parent 1229fd100f
commit ce53b11cf7

View File

@@ -94,7 +94,9 @@ class BaseHandler(RequestHandler):
def finish(self, *args, **kwargs):
"""Roll back any uncommitted transactions from the handler."""
self.db.rollback()
if self.db.dirty:
self.log.warning("Rolling back dirty objects %s", self.db.dirty)
self.db.rollback()
super().finish(*args, **kwargs)
#---------------------------------------------------------------