[Zope3-dev] FW: [Zope3-checkins] SVN:
Zope3/trunk/src/zope/security/untrustedpython/builtins.pyIgnoring
missing attributes in __builtins__. I'm running intoa case
where 'copyright' isn't in __builtins__ (using py2exe)and it
seems reasonable to let this and other case
Garrett Smith
garrett at mojave-corp.com
Wed Mar 9 14:09:51 EST 2005
I'm pretty sure this change is benign, but as it effects Zope security
(proxying unstrusted builtins) I want to highlight it for the list.
Please let me know you see a problem with this.
-- Garrett
Garrett Smith wrote:
> missing attributes in __builtins__. I'm running intoa case where
> 'copyright' isn't in __builtins__ (using py2exe)and it seems
> reasonable to let this and other cases of
>
>
> Log message for revision 29428:
> Ignoring missing attributes in __builtins__. I'm running into a
> case where 'copyright' isn't in __builtins__ (using py2exe) and it
> seems reasonable to let this and other cases of missing builtins
> pass.
>
> Changed:
> U Zope3/trunk/src/zope/security/untrustedpython/builtins.py
>
> -=-
> Modified: Zope3/trunk/src/zope/security/untrustedpython/builtins.py
> ===================================================================
> ---
> Zope3/trunk/src/zope/security/untrustedpython/builtins.py
2005-03-09
> 18:53:17 UTC (rev 29427) +++
> Zope3/trunk/src/zope/security/untrustedpython/builtins.py
2005-03-09
> 18:58:22 UTC (rev 29428) @@ -21,7 +21,7 @@ def SafeBuiltins():
>
> builtins = {}
> -
> +
> from zope.security.checker import NamesChecker
> import __builtin__
>
> @@ -65,12 +65,16 @@
> #dir,
> ]:
>
> - value = getattr(__builtin__, name)
> - if isinstance(value, type):
> - value = ProxyFactory(value, _builtinTypeChecker)
> + try:
> + value = getattr(__builtin__, name)
> + except AttributeError:
> + pass
> else:
> - value = ProxyFactory(value)
> - builtins[name] = value
> + if isinstance(value, type):
> + value = ProxyFactory(value, _builtinTypeChecker)
> + else:
> + value = ProxyFactory(value)
> + builtins[name] = value
>
> from sys import modules
>
>
> _______________________________________________
> Zope3-Checkins mailing list
> Zope3-Checkins at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-checkins
More information about the Zope3-dev
mailing list