[Zope3-dev] path adapters
Jean-Marc Orliaguet
jmo at ita.chalmers.se
Fri Sep 2 04:20:11 EDT 2005
Hi!
I have been scratching my head on this one, there is something
counter-intuitive in the way path adapters are used in ZPT.
If I have a path adapter declared as:
<adapter
name="displayable"
provides="zope.app.traversing.interfaces.IPathAdapter"
for="..interfaces.IElement"
factory=".Displayable"
/>
and Displayable:getDisplay takes an optional argument
for a ZPT programmer, it seems natural to write:
tal:define="
displayable nocall:context/displayable; <!-- get the
adapted object -->
display python: displayable.getDisplay(param);" <!-- call the
getDisplay() method -->
but when I do this I get:
raise TraversalError(name)
TraversalError: 'displayable'
this only solution I found was to write:
tal:define="getDisplay nocall:context/displayable/getDisplay;
display python: getDisplay(param);"
But it means that I have to adapt the same object each time, why can't
the adapted object be a variable?
/JM
More information about the Zope3-dev
mailing list