[Zope] Importing Custom Python Classes

Dieter Maurer dieter at handshake.de
Fri Feb 20 16:29:27 EST 2004


D. Bickle wrote at 2004-2-19 12:17 -0800:
>Hmm...The module seems to be importing fine at the python command line.
>Zope complains that it is unauthorized so I am assuming it is being
>imported.

Security declarations to allow module import must be in
a module that is imported from trusted code (usually a product's
"__init__.py" but that is not necessary).

To put the declarations in the module itself will not help
(unless this module is imported from trusted code before
you try to import it from TTW code).

>On Thu, 19 Feb 2004, Dieter Maurer wrote:
>
>> D. Bickle wrote at 2004-2-18 16:01 -0800:
>> >How do you import your own python class modules into Zope?
>> > ...
>> >	Then I add the security declarations:
>> >
>> >	from ClassModule.ClassModule import Class1
>> >	allow_module('ClassModule.ClassModule')
>> >	allow_class(Class1)
>> >
>> >
>> >I created a ClassModule directory in the Products directory and placed
>> >ClassModule.py class module in it.
>> >
>> >I then rebooted the Zope server.
>> >
>> >Now everytime I try this:
>> >	from ClassModule.ClassModule import Class1
>> >I get this error:
>> >	import of ClassModule.ClassModule is unauthorized.
>>
>>
>> Are you sure that your module is imported?
>> If not, your security declaration are never executed
>> (and therefore ineffective).

-- 
Dieter



More information about the Zope mailing list