From: schettino72 Date: Wed, 6 Nov 2013 09:52:40 +0000 (+1300) Subject: Add support for python3.3 list.clear() on orm.collections X-Git-Tag: rel_0_9_0~67^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=af192056ddcbf2e19500dd346ddc496bc1620f66;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Add support for python3.3 list.clear() on orm.collections --- diff --git a/lib/sqlalchemy/orm/collections.py b/lib/sqlalchemy/orm/collections.py index 6bd5ac968e..fd1677058e 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