[Zope3-Users] z3c.form traversable widget

Fernando Correa Neto fcdoth at gmail.com
Mon Apr 7 23:55:49 EDT 2008


Hi there.


I am trying to port z3c.widget.namespace so I can use what I had in
zope.formlib already and I am having a hard time here.
The namespace code is very simple and is almost identical with
z3c.widget.namespace. The only difference is that I've registered the
view to z3c.form.interface.IWidget and will need some other code to
fullfill what is needed.
The namespace is like the following.

namespace.py:

class WidgetHandler(SimpleHandler):

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

    def traverse(self, name, ignored):
        name = name.split('.')[-1]
        removeSecurityProxy(self.context).update()
        widget = removeSecurityProxy(self.context).field.widgets[name]
        return widget

When I try something like:

http://localhost:8080/myapp/somez3cform/++widget++id/helpermethod

It won't traverse because my context is a z3c.pagelet and it is 100% empty.

(Pdb) self.context
<z3c.pagelet.zcml.MyAddForm object at 0x2ebfc50>
(Pdb) dir(self.context)
()

Does anyone know how to traverse to a z3c.form widget?

Best Regards,
Fernando


More information about the Zope3-users mailing list