[Zope] Argument passing and DTMLFile methods

Dieter Maurer dieter@handshake.de
Mon, 1 Jul 2002 22:23:23 +0200


Terry Hancock writes:
 > Dieter Maurer wrote:
 > > In a Python method context, this looks like
 > > 
 > >             mydtml_submethod(self, self.REQUEST, keyword_parameters)
 > 
 > Okay, I guess this would work from a Python method (I
 > haven't tried that yet...
Maybe, you should state concisely from what context you want to
pass parameters to DTMLFile methods:

  DTMLFile objects behave identically in this respect to
  DTML methods!

    *  When called from ZPublisher (i.e. from the Web),
       ZPublisher provides the object, the DTML is called for,
       as "client" and "REQUEST" as "REQUEST".

    *  When called from DTML or Page Templates, "None"
       is passed as "client" and a DTML namespace as "REQUEST".

    *  When you call it from either a Python method in your product,
       from an External Method or from a Python Script,
       you must pass sensible values for the two
       positional parameters "client" and "REQUEST".
       Often this is "self" and "self.REQEUST" (respectively
       "context" and "context.REQUEST", in a Python script).


Dieter