[Zope-dev] urllib not available in Python Scripts?

Evan Simpson evan@4-am.com
Sat, 16 Dec 2000 11:18:13 -0500


From: "Itai Tavor" <itai@optusnet.com.au>
> The reason I could do urllib.quote in Python Methods was that I
> implemented the MoreBuiltins trick someone described here a while
> ago.

That would be me :-)

> Is there anything that can be done so that adding modules continues
> to work?

Sure.  Since you've already got a MoreBuiltins module, that's probably a
fine place to put this.  In MoreBuiltins/__init__.py (or a brand new Product
directory of your choice) put the following lines:

  import urllib
  urllib.__allow_access_to_unprotected_subobjects__ = 1

...and similarly if you want to declare other modules PS-importable.  As of
2.3, the proper way to do this will be:

  from AccessControl import ModuleSecurityInfo
  ModuleSecurityInfo('urllib').setDefaultAccess(1)

Cheers,

Evan @ digicool & 4-am