From: Mike Bayer Date: Wed, 5 Sep 2007 23:05:39 +0000 (+0000) Subject: do the cheaper check first.... X-Git-Tag: rel_0_4beta6~44 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5edafbe9551ca12239f434f7165fea2d4de8d296;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git do the cheaper check first.... --- diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index 7290e2ac23..c2746d9e98 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -702,10 +702,15 @@ class AttributeManager(object): return noninherited def is_modified(self, object): - for attr in self.managed_attributes(object.__class__): - if attr.check_mutable_modified(object): - return True - return object._state.modified + if object._state.modified: + return True + else: + for attr in self.managed_attributes(object.__class__): + if attr.check_mutable_modified(object): + return True + else: + return False + def get_history(self, obj, key, **kwargs): """Return a new ``AttributeHistory`` object for the given