[Zope3-dev] path adapters

Jean-Marc Orliaguet jmo at ita.chalmers.se
Sun Sep 11 11:32:32 EDT 2005


Stephan Richter wrote:

>On Friday 02 September 2005 04:20, Jean-Marc Orliaguet wrote:
>  
>
>>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?
>>    
>>
>
>Path adapters are not designed to support arguments in function calls and 
>should be used as follows:
>
>context/displayable:getDisplay
>
>Functions on a path adapter should only rely on the context. Otherwise use a 
>view.
>
>Regards,
>Stephan
>  
>

Hi, if I remember correctly, the reason why I asked the question was
because the ZPT path adapter implementation feels counter-intuitive in
the sense that it break a programming pattern used in python and in ZPT
otherwise.

why can't the following python pattern:

    displayable = IDisplayable(context)
    display = displayable.getDisplay()

be transposed in ZPT as:

tal:define="
    displayable nocall:context/displayable;
    display displayable/getDisplay;
"

or as the one would write with any object:

tal:define="
    object nocall:context/getObject;
    value object/getValue;
"

it there any technical reason why:

   tal:define="displayable nocall:context/displayable"

could not return the adapted object based on the context instead of
triggering a traversal error?

regards /JM


More information about the Zope3-dev mailing list