collective / collective.z3cform.widgets

A widget package for Plone 4 projects.
8 stars 8 forks source link

Bugs in widgets #8

Closed pbauer closed 12 years ago

pbauer commented 12 years ago

I tried to test the fields (in Plone 4.1.5 and 4.2rc2) and ran into some Problems

EnhancedTextLinesFieldWidget seems broken:

    form.widget(option1=EnhancedTextLinesWidget)
    option1 = schema.Tuple(
            title=_(u"Option 1: EnhancedTextLinesWidget"),
            value_type=schema.TextLine(),
            missing_value=(),
            required=False,
        )

Results in:

2012-06-28 17:39:26 ERROR Zope.SiteErrorLog 1340897966.690.584569291514 http://localhost:8080/Plone/institut/mitarbeiter/tester/@@edit
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 46, in call_object
  Module plone.z3cform.layout, line 70, in __call__
  Module plone.z3cform.layout, line 54, in update
  Module plone.dexterity.browser.edit, line 52, in update
  Module plone.z3cform.fieldsets.extensible, line 59, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 125, in update
  Module z3c.form.form, line 134, in updateWidgets
  Module z3c.form.field, line 255, in update
TypeError: __init__() takes exactly 2 arguments (3 given)

TokenInputFieldWidget does not display saved values.

The MultiContentSearchFieldWidget seems not to work

    form.widget(option3=MultiContentSearchFieldWidget)
    option3 = RelationList(
        title=_(u"Option 3: MultiContentSearchFieldWidget"),
        default=[],
        value_type=RelationChoice(title=u"Related",
            source=ObjPathSourceBinder(portal_type='Document')),
        )
2012-06-28 17:55:18 ERROR Zope.SiteErrorLog 1340898918.030.940529454711 http://localhost:8080/Plone/institut/mitarbeiter/tester/@@edit
Traceback (innermost last):
  Module ZPublisher.Publish, line 126, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 46, in call_object
  Module plone.z3cform.layout, line 70, in __call__
  Module plone.z3cform.layout, line 54, in update
  Module plone.dexterity.browser.edit, line 52, in update
  Module plone.z3cform.fieldsets.extensible, line 59, in update
  Module plone.z3cform.patch, line 30, in GroupForm_update
  Module z3c.form.group, line 138, in update
  Module z3c.form.action, line 99, in execute
  Module z3c.form.button, line 315, in __call__
  Module z3c.form.button, line 170, in __call__
  Module plone.dexterity.browser.edit, line 27, in handleApply
  Module z3c.form.group, line 107, in applyChanges
  Module z3c.form.form, line 52, in applyChanges
  Module plone.app.relationfield.widget, line 127, in set
  Module five.intid.intid, line 41, in getId
  Module zope.intid, line 89, in getId
KeyError: <ATDocument at /Plone/ein-dokument>

And: the documentation is not great. The needed imports are missing and fieldnames don't match.

hvelarde commented 12 years ago

yes, the documentation sucks (are you listening, @flecox) but we are in the middle of something else right now (collective.composition) and we can not help you until late next week.

could you please take a look at collective.nitf and collective.polls? they have implementations for these widgets...

flecox commented 12 years ago

Hi.. as Hector said, as soons as possible we'll update the documentation. to use the first widget, EnhancedTextLinesWidget, you have to use EnhancedTextLinesFieldWidget.

and I'll take a look at MultiContentSearchFieldWidget problem as soon as I can.. have you try it filtering a dexterity ct instead of Document?

regards

pbauer commented 12 years ago

Thanks for the answers. I fixed some of the more obvious errors in the readme. The EnhancedTextLinesFieldWidget Works for me now.

The MultiContentSearchFieldWidget works with dexterity-content and with AT-Content that has a uuid.

The TokenInputFieldWidget still does not display saved values in edit-mode.

hvelarde commented 12 years ago

you need to override the widget: take a look at collective/nitf/__init__.py.