From a26f40a1034ee53b433a28df85c6cb4ad4bdb40d Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Wed, 24 Oct 2012 14:39:28 +0200 Subject: [PATCH] Allow using enumerate's "start" argument on python>=2.6 . --- product/ERP5Type/patches/Restricted.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/product/ERP5Type/patches/Restricted.py b/product/ERP5Type/patches/Restricted.py index b2d7494840..10606aef32 100644 --- a/product/ERP5Type/patches/Restricted.py +++ b/product/ERP5Type/patches/Restricted.py @@ -110,6 +110,11 @@ def guarded_reversed(seq): return SafeIter(reversed(seq)) safe_builtins['reversed'] = guarded_reversed +if sys.version_info >= (2, 6): + def guarded_enumerate(seq, start=0): + return NullIter(enumerate(guarded_iter(seq), start=start)) + safe_builtins['enumerate'] = guarded_enumerate + def get_set_pop(s, name): def guarded_pop(): v = s.pop() -- 2.30.9