]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
[ticket:324]
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 5 Oct 2006 01:39:44 +0000 (01:39 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Thu, 5 Oct 2006 01:39:44 +0000 (01:39 +0000)
lib/sqlalchemy/attributes.py

index 388c10bceec9c04ab3792fed66defa20b9a33f74..67c23ba952ae3ad5b93aff6fd384a97f4a80dca1 100644 (file)
@@ -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.