From: Mike Bayer Date: Thu, 5 Oct 2006 01:39:44 +0000 (+0000) Subject: [ticket:324] X-Git-Tag: rel_0_3_0~84 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8b1afef6e92199691f250213042166bfcbd5d024;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git [ticket:324] --- diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py index 388c10bcee..67c23ba952 100644 --- a/lib/sqlalchemy/attributes.py +++ b/lib/sqlalchemy/attributes.py @@ -508,19 +508,21 @@ class GenericBackrefExtension(AttributeExtension): class CommittedState(object): """stores the original state of an object when the commit() method on the attribute manager is called.""" + NO_VALUE = object() + def __init__(self, manager, obj): self.data = {} for attr in manager.managed_attributes(obj.__class__): self.commit_attribute(attr, obj) - def commit_attribute(self, attr, obj, value=False): + def commit_attribute(self, attr, obj, value=NO_VALUE): """establish the value of attribute 'attr' on instance 'obj' as "committed". this corresponds to a previously saved state being restored. """ - if value is False: + if value is CommittedState.NO_VALUE: if obj.__dict__.has_key(attr.key): value = obj.__dict__[attr.key] - if value is not False: + if value is not CommittedState.NO_VALUE: self.data[attr.key] = attr.copy(value) # not tracking parent on lazy-loaded instances at the moment.