[Zope] odd behavior when External Method calls DTML Method
Dieter Maurer
dieter@handshake.de
Thu, 18 Apr 2002 22:47:08 +0200
Thomas B. Passin writes:
> > def ExternalMethod(self):
> > ....
> This is not the correct way to write an external method. First of all,
> Python does not have a "self" parameter or property. The name is used, by
> convention, in defining classes, and has nothing to do with function
> definitions. Even though you may call it "self", it is just a parameter to
> be passed in like any other.
What you say is right for normal Python function but *wrong* for
External Methods!
External Methods have some calling magic that depends on the
name of the first parameter. It must be "self" for the magic
to apply.
You find a description in the "External Method" section of
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
> ....
> I can't say why "URL" is not being found ...
It because the DTML object has only one of its two positional
arguments. "self.request" should be the second.
Explanation in the "Calling DTML objects" of
<http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html>
Dieter