From 5edafbe9551ca12239f434f7165fea2d4de8d296 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Wed, 5 Sep 2007 23:05:39 +0000 Subject: [PATCH] do the cheaper check first.... --- lib/sqlalchemy/orm/attributes.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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 -- 2.47.3