[Zope] zpt weirdness?

Luca Olivetti luca@wetron.es
Wed, 20 Mar 2002 15:58:39 +0100


Luca Olivetti wrote:

> So I changed the tal:define="client item/getClient" to 
> tal:define="client nocall:item/getClient"
> 
> This solved the recursion problem but now I could not use "client/id" 
> and "client/absolute_url" (and permutations like "python:client.getId()" 
> and "python:client.absolute_url()").

Duh, I got it, even without help from the list :-/

tal:define="client nocall:item/getClient" will return the *method* getClient and not the 
object returned by it, so it's obvious that a "python method" doesn't have such 
attributes as "absolute_url" or "id" :-)

The correct incantation is
tal:define="client python:item.getClient()"

BTW, the correct condition to test if the returned object is not None is
tal:condition="python: client"
and not
tal:condition="client" (which works but would cause the object to render).

Thank you again.
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007