summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/mapping
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/mapping')
-rw-r--r--lib/sqlalchemy/mapping/objectstore.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/sqlalchemy/mapping/objectstore.py b/lib/sqlalchemy/mapping/objectstore.py
index 6b3d7f034..d6b476562 100644
--- a/lib/sqlalchemy/mapping/objectstore.py
+++ b/lib/sqlalchemy/mapping/objectstore.py
@@ -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."""