summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/attributes.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2006-06-16 03:19:53 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2006-06-16 03:19:53 +0000
commit091d40344ebeedd4633841146449ac772e33b631 (patch)
tree9c6fb01ac1fd694345f29aff0cc52bc35c9ca555 /lib/sqlalchemy/attributes.py
parentb63c5cc8b150e02c29e470cccd95b261d312654f (diff)
downloadsqlalchemy-091d40344ebeedd4633841146449ac772e33b631.tar.gz
fixed bug where if a many-to-many table mapped as "secondary" had other cols in it, delete operations would try to match up on those columns. also fixed bug in new attributes if you set a list based attribute to a blank list, properly fires the 'delete' event for the elements of the previous list
Diffstat (limited to 'lib/sqlalchemy/attributes.py')
-rw-r--r--lib/sqlalchemy/attributes.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/sqlalchemy/attributes.py b/lib/sqlalchemy/attributes.py
index a9b313401..60cbecec1 100644
--- a/lib/sqlalchemy/attributes.py
+++ b/lib/sqlalchemy/attributes.py
@@ -167,8 +167,7 @@ class InstrumentedAttribute(object):
trig()
if self.uselist:
value = InstrumentedList(self, obj, value)
- elif self.trackparent or len(self.extensions):
- old = self.get(obj)
+ old = self.get(obj)
obj.__dict__[self.key] = value
state['modified'] = True
if not self.uselist:
@@ -179,7 +178,10 @@ class InstrumentedAttribute(object):
self.sethasparent(old, False)
for ext in self.extensions:
ext.set(event or self, obj, value, old)
-
+ else:
+ # set the deleted event for the old item
+ old[:] = []
+
def delete(self, event, obj):
"""deletes a value from the given object. 'event' is the InstrumentedAttribute that
initiated the delete() operation and is used to control the depth of a circular delete
@@ -499,7 +501,7 @@ class AttributeHistory(object):
else:
self._deleted_items = []
self._unchanged_items = []
-
+ #print "orig", original, "current", current, "added", self._added_items, "unchanged", self._unchanged_items, "deleted", self._deleted_items
def __iter__(self):
return iter(self._current)
def added_items(self):