]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
- Fire delrecord events when items are discard()ed from a set-backed
authorJason Kirtland <jek@discorporate.us>
Tue, 24 Apr 2007 02:03:53 +0000 (02:03 +0000)
committerJason Kirtland <jek@discorporate.us>
Tue, 24 Apr 2007 02:03:53 +0000 (02:03 +0000)
  InstrumentedList, just like remove().

lib/sqlalchemy/orm/attributes.py

index f706ca7e71b13c23ab794fd33f8f552d11d61c9d..9f8a04db850fd40d7df1858d37532e327b205890 100644 (file)
@@ -595,6 +595,11 @@ class InstrumentedList(object):
         self.__delrecord(item)
         self.data.remove(item)
 
+    def discard(self, item):
+        if item in self.data:
+            self.__delrecord(item)
+            self.data.remove(item)
+
     def extend(self, item_list):
         for item in item_list:
             self.append(item)