From: Mike Bayer Date: Fri, 11 Feb 2011 23:24:36 +0000 (-0500) Subject: ugh. OK let is_modified accept true/false X-Git-Tag: rel_0_7b1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff1ca08b8ff4f9f5eaf261e067b0d7ad0d7a535d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git ugh. OK let is_modified accept true/false --- diff --git a/lib/sqlalchemy/orm/session.py b/lib/sqlalchemy/orm/session.py index eca88c9dfd..d650bf9b13 100644 --- a/lib/sqlalchemy/orm/session.py +++ b/lib/sqlalchemy/orm/session.py @@ -1554,7 +1554,8 @@ class Session(object): raise - def is_modified(self, instance, include_collections=True, passive=attributes.PASSIVE_OFF): + def is_modified(self, instance, include_collections=True, + passive=attributes.PASSIVE_OFF): """Return ``True`` if instance has modified attributes. This method retrieves a history instance for each instrumented @@ -1569,6 +1570,7 @@ class Session(object): The ``passive`` flag indicates if unloaded attributes and collections should not be loaded in the course of performing this test. + Allowed values include :attr:`.PASSIVE_OFF`, :attr:`.PASSIVE_NO_INITIALIZE`. A few caveats to this method apply: @@ -1598,6 +1600,10 @@ class Session(object): except exc.NO_STATE: raise exc.UnmappedInstanceError(instance) dict_ = state.dict + if passive is True: + passive = attributes.PASSIVE_NO_INITIALIZE + elif passive is False: + passive = attributes.PASSIVE_OFF for attr in state.manager.attributes: if \ (