Wrong call to DTML objects (was: [Zope] "ZopeTime is not defined" error)

Dieter Maurer dieter@handshake.de
Mon, 28 Jan 2002 20:59:37 +0100


Keith J. Farmer writes:
 > ... accessing "ZopeTime" raises NameError ....
 > ##### Traceback:
 > ...
 >   File C:\PROGRA~1\Zope\lib\python\DocumentTemplate\DT_String.py, line
 > 473, in __call__
 >     (Object: calendar_entry_add)
 >   File C:\PROGRA~1\Zope\lib\python\DocumentTemplate\DT_Util.py, line
 > 159, in eval
 >     (Object: REQUEST.set('ts', ZopeTime()))
 >     (Info: REQUEST)
 >   File <string>, line 2, in f
 > NameError: (see above)
When will all Zope users finally have learned how to call DTML objects?

  Two positional arguments are necessary to provide context to
  DTML object calls: "client" and "REQUEST".
  "client" needs to be an object (or "None"), "REQUEST" a mapping
  (or "None"). DTML methods have only these to objects as Zope context.
  DTML documents have themselves (in addition).

  You pass "REQUEST" as first parameter. First, it does not contain
  "ZopeTime". Second, it is passed at the wrong position (first
  rather than second).

More information: the "Calling DTML objects" section of

  <http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>




Dieter