From: Mike Bayer Date: Sat, 25 Mar 2006 01:58:27 +0000 (+0000) Subject: added check in SessionTrans.begin() that the underlying unit of work is still the... X-Git-Tag: rel_0_1_5~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f922fa7b6032370c8cf86c0710727aeee37baff8;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git added check in SessionTrans.begin() that the underlying unit of work is still the current uow --- 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."""