Commit 28fffd4e authored by Julien Muchembled's avatar Julien Muchembled

Drop support for Python < 2.6 in patches/Restricted.py

This was forgotten in commit 48212534
("Drop support for Zope 2.8").
parent 61caece9
...@@ -38,11 +38,9 @@ del safe_builtins['list'] ...@@ -38,11 +38,9 @@ del safe_builtins['list']
add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented, add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented,
dict=dict, list=list, set=set, frozenset=frozenset) dict=dict, list=list, set=set, frozenset=frozenset)
add_builtins(classmethod=classmethod, object=object, property=property, add_builtins(bin=bin, classmethod=classmethod, format=format, object=object,
slice=slice, staticmethod=staticmethod, super=super, type=type) property=property, slice=slice, staticmethod=staticmethod,
super=super, type=type)
if sys.version_info >= (2, 6):
add_builtins(bin=bin, format=format)
def guarded_next(iterator, default=_marker): def guarded_next(iterator, default=_marker):
"""next(iterator[, default]) """next(iterator[, default])
...@@ -89,16 +87,6 @@ def get_iteritems(c, name): ...@@ -89,16 +87,6 @@ def get_iteritems(c, name):
return lambda: SafeIterItems(c.iteritems(), c) return lambda: SafeIterItems(c.iteritems(), c)
_dict_white_list['iteritems'] = get_iteritems _dict_white_list['iteritems'] = get_iteritems
if sys.version_info < (2, 5):
# these are backported in Products.ERP5Type.patches.python
def guarded_any(seq):
return any(guarded_iter(seq))
safe_builtins['any'] = guarded_any
def guarded_all(seq):
return all(guarded_iter(seq))
safe_builtins['all'] = guarded_all
def guarded_sorted(seq, cmp=None, key=None, reverse=False): def guarded_sorted(seq, cmp=None, key=None, reverse=False):
if not isinstance(seq, SafeIter): if not isinstance(seq, SafeIter):
for i, x in enumerate(seq): for i, x in enumerate(seq):
...@@ -110,10 +98,9 @@ def guarded_reversed(seq): ...@@ -110,10 +98,9 @@ def guarded_reversed(seq):
return SafeIter(reversed(seq)) return SafeIter(reversed(seq))
safe_builtins['reversed'] = guarded_reversed safe_builtins['reversed'] = guarded_reversed
if sys.version_info >= (2, 6): def guarded_enumerate(seq, start=0):
def guarded_enumerate(seq, start=0):
return NullIter(enumerate(guarded_iter(seq), start=start)) return NullIter(enumerate(guarded_iter(seq), start=start))
safe_builtins['enumerate'] = guarded_enumerate safe_builtins['enumerate'] = guarded_enumerate
def get_set_pop(s, name): def get_set_pop(s, name):
def guarded_pop(): def guarded_pop():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment