summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2013-11-30 16:17:27 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2013-11-30 16:17:27 -0500
commit12b05adbb118b8501eb79abeb2c821e1a8f89ce9 (patch)
tree2a868a0e1a7c112a3b9b7f5e651bda10d778419b /lib
parent92d8baeb95204ddc2c6b78a1c63194b04e3ae952 (diff)
parent8fc91105a0ee484fb9c76e7e957c78a5f1901ddb (diff)
downloadsqlalchemy-12b05adbb118b8501eb79abeb2c821e1a8f89ce9.tar.gz
Merge branch 'orm-collections-list-clear' of github.com:schettino72/sqlalchemy into list_clear
Diffstat (limited to 'lib')
-rw-r--r--lib/sqlalchemy/orm/collections.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py
index 6bd5ac968..ffd0b8c37 100644
--- a/lib/sqlalchemy/orm/collections.py
+++ b/lib/sqlalchemy/orm/collections.py
@@ -1161,6 +1161,14 @@ def _list_decorators():
_tidy(pop)
return pop
+ def clear(fn):
+ def clear(self, index=-1):
+ 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