[Grok-dev] ListSequenceWidget - How to change the sequence
Christian Klinger
cklinger at novareto.de
Thu Jul 22 04:57:34 EDT 2010
Sascha,
maybe you can try this:
####
form z3c.listjs.widgets import _ListJsWidget
def CustomListJsWidget(field, request, subwidget=None):
return _ListJsWidget(field, field, request, subwidget=subwidget)
dfe_widget = CustomWidgetFactory(CustomListJsWidget,
subwidget=object_widget)
Not sure if it helps....
Christian
> Hey Sascha,
>
> Sorry no idea, i don't work with formlib.
>
> But if you can copy me the relevant code. I will try to run it
> in an empty grokproject. Maybe this helps...
>
> Christian
>
>> Thanks, Christian. Sounds great, however... I get the following error:
>>
>> File
>> '/root/.buildout/eggs/Paste-1.7.2-py2.6.egg/paste/evalexception/middleware.py',
>> line 306 in respond
>> app_iter = self.application(environ, detect_start_response)
>> File
>> '/root/.buildout/eggs/zope.app.wsgi-3.6.1-py2.6.egg/zope/app/wsgi/__init__.py',
>> line 59 in __call__
>> request = publish(request, handle_errors=handle_errors)
>> File
>> '/root/.buildout/eggs/zope.publisher-3.12.3-py2.6.egg/zope/publisher/publish.py',
>> line 134 in publish
>> result = publication.callObject(request, obj)
>> File '/root/.buildout/eggs/grok-1.1.1-py2.6.egg/grok/publication.py',
>> line 89 in callObject
>> return super(ZopePublicationSansProxy, self).callObject(request, ob)
>> File
>> '/root/.buildout/eggs/zope.app.publication-3.10.2-py2.6.egg/zope/app/publication/zopepublication.py',
>> line 205 in callObject
>> return mapply(ob, request.getPositionalArguments(), request)
>> <changemgmt.app.ChangemgmtEditForm object at 0x373d890>
>> File
>> '/root/.buildout/eggs/zope.publisher-3.12.3-py2.6.egg/zope/publisher/publish.py',
>> line 109 in mapply
>> return debug_call(obj, args)
>> File
>> '/root/.buildout/eggs/zope.publisher-3.12.3-py2.6.egg/zope/publisher/publish.py',
>> line 115 in debug_call
>> return obj(*args)
>> File
>> '/root/.buildout/eggs/grokcore.formlib-1.5-py2.6.egg/grokcore/formlib/components.py',
>> line 90 in __call__
>> self.update_form()
>> File
>> '/root/.buildout/eggs/grokcore.formlib-1.5-py2.6.egg/grokcore/formlib/components.py',
>> line 62 in update_form
>> super(GrokForm, self).update()
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/form.py',
>> line 746 in update
>> self.setUpWidgets()
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/form.py',
>> line 821 in setUpWidgets
>> adapters=self.adapters, ignore_request=ignore_request
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/form.py',
>> line 399 in setUpEditWidgets
>> widget = _createWidget(form_field, field, request, iface)
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/form.py',
>> line 331 in _createWidget
>> return form_field.custom_widget(field, request)
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/widget.py', line
>> 136 in __call__
>> return self._create(args)
>> File
>> '/root/.buildout/eggs/zope.formlib-4.0-py2.6.egg/zope/formlib/widget.py', line
>> 118 in _create
>> instance = self._widget_factory(*args)
>> TypeError: ListJsWidget() takes exactly 2 arguments (3 given)
>>
>> Code:
>>
>> class FooEditForm(grok.EditForm):
>> grok.context(Foo)
>> grok.name('admin')
>>
>> form_fields = grok.AutoFields(Foo)
>> object_widget = CustomWidgetFactory(ObjectWidget, FooField)
>> dfe_widget = CustomWidgetFactory(ListJsWidget, subwidget=object_widget)
>>
>> Any ideas?
>>
>> Regards,
>> Sascha
>>
>>
>>
>> --
>> GMX DSL: Internet-, Telefon- und Handy-Flat ab 19,99 EUR/mtl.
>> Bis zu 150 EUR Startguthaben inklusive! http://portal.gmx.net/de/go/dsl
>>
>>
>>
>> _______________________________________________
>> Grok-dev mailing list
>> Grok-dev at zope.org
>> https://mail.zope.org/mailman/listinfo/grok-dev
More information about the Grok-dev
mailing list