[ZPT] Using alternatives to Zope's DateTime module in PageTemplates

Dieter Maurer dieter at handshake.de
Wed Nov 15 15:01:40 EST 2006


Charlie Clark wrote at 2006-11-15 20:15 +0100:
> ..
>>> import datetime
>>>
>>> allow_type(datetime.datetime)
>>>
>>> do work but
>>>
>>> calling strftime() on a datetime object throws an import error
>>>
>>> Error Type: ImportError
>>> Error Value: import of "__doc__" from "time" is unauthorized. You are  
>>> not
>>> allowed to access '__doc__' in this context
> ...
>   Module None, line 31, in generate
>    - <PythonScript at /psytec/scripts/generate>
>    - Line 31
>   Module AccessControl.ZopeGuards, line 284, in guarded_import
>ImportError: import of "__doc__" from "time" is unauthorized. You are not  
>allowed to access '__doc__' in this context

What code do you see in line 31 of "psytec/scripts/generate".

I expect an "import time" there and would be really surprised
when it would contain "someDateTimeObject.strftime(...)".

If I am wrong, then the "RestrictedPython" compiler would
probably generate wrong code.



-- 
Dieter


More information about the ZPT mailing list