[Zope-dev] ZPatterns: Methods of specialits

Phillip J. Eby pje@telecommunity.com
Wed, 22 Nov 2000 11:18:12 -0500


At 12:41 PM 11/22/00 +0200, Roch'e Compaan wrote:
>I have a specialist Contacts and for Contacts I have a method
>getAllContactsForCustomer.  Whenever I want to call this method I have to
>pass on the whole namespace and the object itself to get it to work eg:
>getAllContactsForCustomer(this(), _, _.None).  Why is this the case?  And
>what does _.None actually mean?
>

If your method is a DTML method or document, it does not automatically
supply a "self", so currently you must call such methods in a specialist
like this:

Specialist.someDTMLthing(Specialist,_,...)

Where "..." represents any other arguments you wish to pass the method.
(They must be passed as keyword arguments.)

This is a DTML issue, not a ZPatterns one.  Hopefully, in later versions of
Zope, if method binding is standardized across DTML, Python, etc. method
objects, then you will be able to avoid this issue by setting binding
settings on the method object itself.