summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschettino72 <schettino72@gmail.com>2013-11-06 22:52:40 +1300
committerschettino72 <schettino72@gmail.com>2013-11-06 22:52:40 +1300
commitaf192056ddcbf2e19500dd346ddc496bc1620f66 (patch)
treee5829f76e7958a56b70195c2c0cfdfe036649ea7
parent5d0e84434f116460d64d3078f650d9c89004f2a9 (diff)
downloadsqlalchemy-af192056ddcbf2e19500dd346ddc496bc1620f66.tar.gz
Add support for python3.3 list.clear() on orm.collections
-rw-r--r--lib/sqlalchemy/orm/collections.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index 6bd5ac968..fd1677058 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -1161,6 +1161,15 @@ def _list_decorators():
_tidy(pop)
return pop
+ def clear(fn):
+ def clear(self, index=-1):
+ __before_delete(self)
+ for item in self:
+ __del(self, item)
+ fn(self)
+ _tidy(clear)
+ return clear
+
# __imul__ : not wrapping this. all members of the collection are already
# present, so no need to fire appends... wrapping it with an explicit
# decorator is still possible, so events on *= can be had if they're