[Zope] how can I use the python set-type in pythonscripts ?

Dieter Maurer dieter at handshake.de
Thu Dec 21 14:27:06 EST 2006


joachim wrote at 2006-12-20 18:57 +0100:
>I did a
>
>allow_type(type(set))

This should be "allow_type(set)".

>in the __init__ of my product. But when I use it in a Python script I
>get global name 'set' is not defined.

Allowing a type does not automatically mean that it gets available
in the builtin namespace for untrusted code.

I would do the following:

   Define a module, say "importable", which imports all 
   objects you want to make available to untrusted code.

   Declare this module importable via "allow_module(importable)".

   Provide (e.g. in the module) all "allow_type" you want.

   Import your resources in your untrusted code.

An example of this approach is "Products.PythonScripts.standard").



-- 
Dieter


More information about the Zope mailing list