]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
restored functionality to not issue DELETE for instances that have no _identity_key
authorMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Apr 2007 00:09:25 +0000 (00:09 +0000)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 27 Apr 2007 00:09:25 +0000 (00:09 +0000)
lib/sqlalchemy/orm/mapper.py

index 98b4dca48f8cda829a5b822166d1c022c080960f..ea5aa556ff54413f4ac244cc239a94051ab32777 100644 (file)
@@ -1274,10 +1274,12 @@ class Mapper(object):
                 mapper = object_mapper(obj)
                 if table not in mapper.tables or not mapper._has_pks(table):
                     continue
-                instance_key = mapper.instance_key(obj)
 
                 params = {}
-                delete.append(params)
+                if not hasattr(obj, '_instance_key'):
+                    continue
+                else:
+                    delete.append(params)
                 for col in mapper.pks_by_table[table]:
                     params[col.key] = mapper.get_attr_by_column(obj, col)
                 if mapper.version_id_col is not None: