From: Mike Bayer Date: Fri, 27 Apr 2007 00:09:25 +0000 (+0000) Subject: restored functionality to not issue DELETE for instances that have no _identity_key X-Git-Tag: rel_0_3_7~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=683ff64c4b6a142ba219ac53d50d1280b84c1b2a;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git restored functionality to not issue DELETE for instances that have no _identity_key --- diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py index 98b4dca48f..ea5aa556ff 100644 --- a/lib/sqlalchemy/orm/mapper.py +++ b/lib/sqlalchemy/orm/mapper.py @@ -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: