[Zope-dev] Import Libraries into Python Script

Brian Lloyd brian@digicool.com
Fri, 16 Feb 2001 10:55:38 -0500


> What's wrong with:
> 
>     import imaplib
>      imaplib.__allow_access_to_unprotected_subobjects__ = 1

Nothing is wrong with it per se - but using the SecurityInfo 
interfaces (even indirectly through the helper stuff I checked 
in to PythonScripts for 2.3.1) is more future-proof, in case 
the actual mechanics of protection change one day.


> And, if the above is somehow bad or insecure, how would you use your 
> method to allow access to specific methods in a module, as in:
> 
>     import re
>      re.__allow_access_to_unprotected_subobjects__ = {
>          'sub': 1,
>      }

You can see a minimal example in the standard.py module in 
the PythonScripts package (though there is no helper shortcut 
for that method yet - there probably should be).

Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com