Am 16.11.2006, 21:43 Uhr, schrieb Dieter Maurer <[EMAIL PROTECTED]>:

I am not surprised that you are formatting a database result.
I am surprised that in the byte code there is an "import time"
(or an import at all).
I tried to reproduce your problem and failed:
bin/zopectl debug
from datetime import datetime
from AccessControl import allow_type
from Products.PythonScripts.PythonScript import PythonScript
... return dt.strftime('%d.%m.%Y')
... ''')
And this is the Python Script's code:

from dis import dis
  1           0 LOAD_GLOBAL              0 (_getattr_)
              3 LOAD_FAST                0 (dt)
              6 LOAD_CONST               1 ('strftime')
              9 CALL_FUNCTION            2
             12 LOAD_CONST               2 ('%d.%m.%Y')
             15 CALL_FUNCTION            1
             18 RETURN_VALUE
             19 LOAD_CONST               0 (None)
             22 RETURN_VALUE
I am using Zope 2.8.1 with Python 2.4.1.

Interesting - in my script there is actually no import just a formatting statement for something that is subsequently passed to an external method to generate a PDF but is the same error I get when using datetime types. The interesting thing is that allow_type explicitly says that extension types like datetime will not work. I have used "allow_type" in a generic "Tools" script so that I can use in scripts or PageTemplates (which is where it should be allowed to be used). I will give your script a go and see how that works.

Thanks very much for your help and your profound understanding of the internals of Zope.

ZPT mailing list

Reply via email to