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
_______________________________________________
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