[Zope-dev] Import Libraries into Python Script

Itai Tavor itai@optusnet.com.au
Sat, 17 Feb 2001 18:51:42 +1100


Brian Lloyd wrote:

>  > 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.

Thanks for explaining. I read the release notes for 2.3.1 just hours 
after sending my question. Doing this with the new helper functions 
sounds like a good way.


>  > 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).

A helper shortcut would be nice :)
--
Itai Tavor                      -- "Je sautille, donc je suis."    --
itai@optusnet.com.au            --               - Kermit the Frog --
--                                                                 --
-- "Every day, once a day, give yourself a present"  - Dale Cooper --