[Zope] problem with python time-module

Paul Winkler pw_lists@slinkp.com
Wed, 24 Apr 2002 08:05:35 -0700


On Wed, Apr 24, 2002 at 03:31:18PM +0200, Klaus Boehm wrote:
> I have a python script in a zope product.
> 
> With this python script i want convert date time in epoch time.
> 
> If i start the script i get the Authentication window after Cancel
> i get the error message
> "Error Type: Unauthorized
>  Error Value: You are not allowed to access time in this context"
> 
> I can't import time module. Why ??

Python scripts are very restrictive about what you can and can't
import. 
See
http://www.zope.org/Documentation/ZopeBook/ScriptingZope.stx
in the section "Security Restrictions".

You have four choices:

1) write an external method instead of a python script.
external methods can do *anything*.

2) use XXXPythonScripts instead, see
http://www.zope.org/Members/4am/XXXPythonScripts

3) make more modules available to python scripts.
I haven't done this, don't really know how, sorry.

4) Find another way to do your job using only the tools
available to python scripts already. For instance, DateTime objects
are useful.


--PW