From f922fa7b6032370c8cf86c0710727aeee37baff8 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 25 Mar 2006 01:58:27 +0000 Subject: [PATCH] added check in SessionTrans.begin() that the underlying unit of work is still the current uow --- lib/sqlalchemy/mapping/objectstore.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/sqlalchemy/mapping/objectstore.py b/lib/sqlalchemy/mapping/objectstore.py index 6b3d7f034a..d6b4765629 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.""" -- 2.47.2