ZPatterns: Methods of specialits
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? Roché
Hi Roch'e, I'm guessing that getAllContactsForCustomer is a "DTML Method". If I remember correctly the third argument is a 'mapping object' that can be used to augment the effective namespace available to the method. Passing _.None should do nothing (I'm guessing you could just use "getAllContactsForCustomer( this(), _ )" and it would work just fine. This issue has been pretty much hashed to death here in the past. There is even a fishbowl proposal to 'fix it'. http://dev.zope.org/Wikis/DevSite/Proposals/NamespacePassingRevisited -steve
"Roch'e" == Roch'e Compaan <roche@ybm.co.za> writes:
Roch'e> I have a specialist Contacts and for Contacts I have a Roch'e> method getAllContactsForCustomer. Whenever I want to call Roch'e> this method I have to pass on the whole namespace and the Roch'e> object itself to get it to work eg: Roch'e> getAllContactsForCustomer(this(), _, _.None). Why is this Roch'e> the case? And what does _.None actually mean? Roch'e> Roché
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.
participants (3)
-
Phillip J. Eby -
Roch'e Compaan -
Steve Spicklemire