[Zope3-Users] Re: z3c.form traversable widget
Fernando Correa Neto
fcdoth at gmail.com
Tue Apr 8 11:03:27 EDT 2008
Hey updates on this.
It was my fault. The namespace traverser works like a charm.
I just needed to add some more code so it can checks the widget
availability in the form's subform's widgets so I can traverse to
those widgets the exact same way as I do for form's widgets.
Sorry for the buzz.
On Tue, Apr 8, 2008 at 12:55 AM, Fernando Correa Neto <fcdoth at gmail.com> wrote:
> 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.
> class WidgetHandler(SimpleHandler):
> def __init__(self, context, request=None):
> self.context = context
> self.request = request
> def traverse(self, name, ignored):
> name = name.split('.')[-1]
> widget = removeSecurityProxy(self.context).field.widgets[name]
> return widget
> When I try something like:
> 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,
More information about the Zope3-users