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

Charlie Clark charlie at egenix.com
Wed Nov 15 15:07:54 EST 2006


Am 15.11.2006, 21:01 Uhr, schrieb Dieter Maurer <dieter at handshake.de>:

>>   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.

Why are you surprised that I am formatting a database result?

result.create_date.strftime('%d.%m.%Y') # line 31

This has been cast by psycopg to a Python datetime object which I have  
added as an allowed type.

Charlie

-- 
Charlie Clark
eGenix.com

Professional Python Services directly from the Source
>>> Python/Zope Consulting and Support ...        http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ...             http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ...        http://python.egenix.com/
Try mxODBC.Zope.DA for Windows, Mac OS, Linux, Solaris, FreeBSD for free!


More information about the ZPT mailing list