Stephan Richter wrote:

>On Sunday 11 September 2005 11:32, Jean-Marc Orliaguet wrote:
>>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?
>Yes. You are not using the path adapter syntax as far as I can see. You need 
>to have: object/path_adapter_name:function
>You should check the parsing implementation (probably some traversing code) to 
>see about the assumptions.

I know that, I was about to file this as a bug, or write a proposal to let

tal:define="adapted nocall:object/path_adapter_name"

return the adapted object, but I found a workaround, by adding:

    def this(self):
        """Return the adapted object.
        return self

to the adapter. Now I can use instead:

    displayable context/displayable:this;
    display python: displayable.getDisplay(perspective)"

which in terms of performance means that I don't need doing an adapter
lookup for each of the adapter's method that I want to call. That is a
pretty straightforward optimization.

still it feels like an unnecessarily complicated way of doing something


Zope3-dev mailing list

Reply via email to