]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
fixed small expunge() bug where object might not be present in session
authorMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jul 2007 20:38:40 +0000 (20:38 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Tue, 10 Jul 2007 20:38:40 +0000 (20:38 +0000)
lib/sqlalchemy/orm/unitofwork.py

index c6b0b2689c13cbdac05a715520c237d63a9e96df..5f28d28e76db06acd6aa17a6208f457247c94e3f 100644 (file)
@@ -108,7 +108,7 @@ class UnitOfWork(object):
     echo = logging.echo_property()
 
     def _remove_deleted(self, obj):
-        if hasattr(obj, "_instance_key"):
+        if hasattr(obj, "_instance_key") and obj._instance_key in self.identity_map:
             del self.identity_map[obj._instance_key]
         try:
             self.deleted.remove(obj)