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 _______________________________________________ Zope3-dev mailing list Zope3-dev@zope.org Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com