[z3-five] traversing path expression
Tim Terlegård
tim at se.linux.org
Fri Feb 16 15:42:37 CET 2007
On Fri, Feb 16, 2007 at 12:34:33PM +0100, Tim Terlegård wrote:
>
> I'm trying to use Five and plone.app.form to get an automatic edit form
> which uses zope.formlib. There seems to be a problem with traversal of the
> path expressions in the template. I get back None for the 'view/xxx'
> expression for any value of xxx.
>
> The OrderedMultiSelectWidget (orderedSelectionList.pt) is used for showing
> my List field. After debugging the widget, tal etc I finally came to the
> part where traversing apapters are used for finding 'xxx' of the view. The
> widget (which is the view) is adapted to ITraversable in
> zope.app.traversing.adapers.py. It finds Five.traversable.FiveTraversable
> which doesn't look for the 'xxx' attribute, it just looks for an adapter
> with the name 'xxx'. It can't find one and the traversing returns None
> and so does the path expression.
>
> FiveTraversable inherits from DefaultTraversable which seems to look at
> the attribute, but FiveTraversable overrides the traverse method with
> code that doesn't consider the attributes, it only search for an adapter.
This workaround worked.
<adapter
for="zope.app.form.browser.interfaces.IInputWidget"
provides="zope.app.traversing.interfaces.ITraversable"
factory="zope.app.traversing.adapters.DefaultTraversable"
/>
It seems that the widget I use (OrderedMultiSelectWidget) renders itself
and it therefore uses zope3 page template engine, which is not fully
compatible with zope2 (atleast when it comes to path expression
traversing). So problem solved.
Tim
More information about the z3-five
mailing list