[Zope-Checkins] CVS: Zope/lib/python/RestrictedPython -
Guards.py:1.9.2.1
Fred Drake
cvs-admin at zope.org
Wed Nov 5 18:33:43 EST 2003
Update of /cvs-repository/Zope/lib/python/RestrictedPython
In directory cvs.zope.org:/tmp/cvs-serv3807
Modified Files:
Tag: Zope-2_7-branch
Guards.py
Log Message:
Always use the set of exceptions and warnings provided by Python.
=== Zope/lib/python/RestrictedPython/Guards.py 1.9 => 1.9.2.1 ===
--- Zope/lib/python/RestrictedPython/Guards.py:1.9 Wed Jun 11 13:29:26 2003
+++ Zope/lib/python/RestrictedPython/Guards.py Wed Nov 5 18:33:42 2003
@@ -14,6 +14,7 @@
__version__='$Revision$'[11:-2]
+import exceptions
import new
safe_builtins = {}
@@ -21,15 +22,12 @@
'len', 'max', 'min', 'oct', 'ord', 'round', 'str', 'pow',
'apply', 'callable', 'cmp', 'complex', 'isinstance',
'issubclass', 'long', 'repr', 'range', 'list', 'tuple',
- 'unichr', 'unicode',
- 'Exception',
- 'ArithmeticError', 'AssertionError', 'AttributeError',
- 'EOFError', 'EnvironmentError', 'FloatingPointError',
- 'IOError', 'ImportError', 'IndexError', 'KeyError',
- 'LookupError', 'NameError', 'OSError', 'OverflowError',
- 'RuntimeError', 'StandardError', 'SyntaxError',
- 'TypeError', 'UnicodeError', 'ValueError', 'ZeroDivisionError',):
+ 'unichr', 'unicode',):
safe_builtins[name] = __builtins__[name]
+
+for name in dir(exceptions):
+ if name[0] != "_":
+ safe_builtins[name] = getattr(exceptions, name)
def _full_read_guard(g_attr, g_item):
More information about the Zope-Checkins
mailing list