]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
added check in SessionTrans.begin() that the underlying unit of work is still the...
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 25 Mar 2006 01:58:27 +0000 (01:58 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 25 Mar 2006 01:58:27 +0000 (01:58 +0000)
lib/sqlalchemy/mapping/objectstore.py

index 6b3d7f034aaeca1d0a53d97a46d68c4cc2a1b805..d6b47656299a06a3d50d549edf3327c8bca8f62e 100644 (file)
@@ -98,6 +98,8 @@ class Session(object):
         uow = property(lambda s:s.__uow, doc="returns the parent UnitOfWork corresponding to this transaction.")
         def begin(self):
             """calls begin() on the underlying Session object, returning a new no-op SessionTrans object."""
+            if self.parent.uow is not self.uow:
+                raise InvalidRequestError("This SessionTrans is no longer valid")
             return self.parent.begin()
         def commit(self):
             """commits the transaction noted by this SessionTrans object."""