Jim Fulton wrote:

> Jean-Marc Orliaguet wrote:
>
>> 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.
>>>
>>> Regards,
>>> Stephan
>>>
>>>
>>
>>
>> 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:
>
>
> You both are off on the path adapter syntax.  The syntax allows
> the attribute name to be ommitted.  You can write:
>
>   tal:define="adapted nocall:object/path_adapter_name:"
>
> (note the trailing colon)
>

Yes, this is what I tried first (by guessing), but I get a traversal
error unless I write something after the trailing colon

    return traversable.traverse(nm, further_path)
  File "/home/jmo/Zope3/src/zope/app/container/traversal.py", line 100,
in traverse
    raise TraversalError(name)
TraversalError: 'displayable:'

note that the 'IDisplayable' adapter does not implement ITraversable,
but it implements IPathAdapter

class Displayable(object):
    """This adapter makes elements displayable.
    """
    implements(IDisplayable, IPathAdapter)

    def __init__(self, context):
        self.context = context

    def getDisplay(...):
...

adapter ZCML declaration:

  <adapter
      name="displayable"
      provides="zope.app.traversing.interfaces.IPathAdapter"
      for="..interfaces.IElement"
      factory=".Displayable"
  />


so either it is a bug, or am I missing something?

regards /JM
_______________________________________________
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com

Reply via email to