Nils Kassube writes:
* Dieter Maurer <dieter@handshake.de> [2001-05-09 22:02]:
This magic works only, if the method is called with precisely one parameter less then the required arguments. It breaks very likely, when there are default parameters. In this case, you need to pass the "self" parameter explicitly and can not count on the magic.
Nice. So http://www.zope.org/Documentation/How-To/ExternalMethods is wrong in claiming that
--cut-- Argument semantics for External Methods are identical to those for normal Python methods. You can define External Methods with default or keyword arguments just as you can in Python. --cut-- It depends, how you read it:
Of course, you can define External Methods with default and keyword arguments. It will work fine, when you pass the object argument explicitly. It will also work fine, if called through the Web (as ZPublisher uses different magic). Only the automatic passing of the object argument when called from DTML will not work. Dieter
* Dieter Maurer <dieter@handshake.de> [2001-05-11 21:42]:
Only the automatic passing of the object argument when called from DTML will not work.
A little bit or two paragraphs earlier in the same HowTo: --cut-- As in standard Python, the self argument is implicit when calling an External Method and does not need to be passed explicitly by the programmer. Zope will automatically bind self when an External Method is called from DTML. If you define an External Method that takes more arguments than simply self, you need to pass those arguments when calling the External Method from DTML. --cut-- I guess Brian wasn't aware of this problem when writing this. Cheers, Nils
participants (2)
-
Dieter Maurer -
Nils Kassube