[Zope3-Users] stuck with zope.schema.List and subwidget

Adam Groszer adamg at fw.hu
Sat Aug 27 02:42:35 EDT 2005


Hello Christian,

I'm having almost the same problems with a 'simple'
OrderedMultiSelectWidget. Look for the subject
"problems with <browser:widget>" on the list [Zope3-dev].

Saturday, August 27, 2005, 1:01:04 AM, you wrote:

> Hi!

> Did anyone ever test or succeed using the subwidget-directive of
> zope.app.form.browser.sequencewidget.SequenceWidget?

> Following the lines of zope/app/form/browser/widgets.txt a widget for a
> list of objects would be defined by something like this:


> author_w = CustomWidgetFactory(ObjectWidget, Person)

> class ArticleEditView(EditView):
>     authors_widget = CustomWidgetFactory(SequenceWidget, subwidget=author_w)


> Instead of SequenceWidget I tried ListSequenceWidget, too.

> But I allways get the error-message:
> __init__() takes at least 4 arguments (3 given)

> I'm really stuck. Which further argument should I pass to
> CustomWidgetFactory? CustomWidgetFactory--if I get it right--calls the
> constructur of SequenceWidget that complains about the missing argument.
> (self, context, field, request, subwidget=None) is the list of arguments
> of __init__
> Especially: What should I pass as 'field'-argument?
> I played around with the source code and changed the list to (self,
> context, request, subwidget=None) and--WOW-- it presents a form yust as
> I want it. [Now I allways get a new (schema-)error, which I can't track:
> "Es gab *1* Eingabefehler."]

> The constructor of SequenceWidget reads like this:

> def __init__(self, context, field, request, subwidget=None):
>         super(SequenceWidget, self).__init__(context, request)
>         self.subwidget = subwidget

> I really don't understand what is done with 'field'. Where is it passed
> to?


> Can someone give me a hint?


> Kind regards,
> Christian


> PS. I found a way to define a widget for objects of objects yesterday,
> see zope3-users. The example above is taken from there.
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



-- 
Best regards,
 Adam                            mailto:adamg at fw.hu
--
Quote of the day:
Birth: The first and direst of all disasters.



More information about the Zope3-users mailing list