From 088460f22200023070896211c649c59111969c98 Mon Sep 17 00:00:00 2001 From: Jason Kirtland Date: Tue, 24 Apr 2007 02:03:53 +0000 Subject: [PATCH] - Fire delrecord events when items are discard()ed from a set-backed InstrumentedList, just like remove(). --- lib/sqlalchemy/orm/attributes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/sqlalchemy/orm/attributes.py b/lib/sqlalchemy/orm/attributes.py index f706ca7e71..9f8a04db85 100644 --- a/lib/sqlalchemy/orm/attributes.py +++ b/lib/sqlalchemy/orm/attributes.py @@ -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) -- 2.47.2