[Zope] Calling a dtml method from a product

Dieter Maurer dieter@handshake.de
Thu, 4 Apr 2002 20:48:35 +0200


Geoff Armstrong writes:
 > At 11:03 +0100 4/4/02, hans wrote:
 > 
 > I managed to solve it with the following:
 > 
 > myResult_if_any = DTMLMethod.DTMLMethod.__call__(self.catalog_items2,
 > REQUEST='REQUEST')
Your problem has been the reference to an undefined name REQUEST.

By wrapping REQUEST into a string literal, you no longer reference it
as a name (or variable).

But you are very lucky, that it works now. There is a really high
chance that it would not work!

The "REQUEST" argument is expected to be a mapping object not a string.
Passing a string is worse (maybe equally bad) than not passing REQUEST
at all!

Furthermore, an additional argument, called "client", is usually
essential to call DTML objects.

Please read "Calling DTML Objects" in

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




Dieter