summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/util.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sqlalchemy/util.py')
-rw-r--r--lib/sqlalchemy/util.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/sqlalchemy/util.py b/lib/sqlalchemy/util.py
index d60166a0c..2b522d571 100644
--- a/lib/sqlalchemy/util.py
+++ b/lib/sqlalchemy/util.py
@@ -365,14 +365,19 @@ class HistoryArraySet(UserList.UserList):
for key, status in self.records.iteritems():
if status is False or status is None:
list.append(key)
- self.data[:] = []
+ self._clear_data()
self.records = {}
for l in list:
self.append_nohistory(l)
def clear(self):
"""clears the list and removes all history."""
- self.data[:] = []
+ self._clear_data()
self.records = {}
+ def _clear_data(self):
+ if isinstance(self.data, dict):
+ self.data.clear()
+ else:
+ self.data[:] = []
def added_items(self):
"""returns a list of items that have been added since the last "committed" state."""
return [key for key in self.data if self.records[key] is True]