schema.Data as field in collective.z3c.datagridfield

I have a schema.Data field as part of a datagridfield definition

class ITableRowSchema(form.Schema):

    date_from = schema.Date(
        title=u'Start date',
        required=True,
        default=date_default
    )
    ....


class ISeminar(model.Schema):

    form.widget(table=DataGridFieldFactory)
    table = schema.List(title=u"Nested selection tree test",
        value_type=DictRow(title=u"tablerow", schema=ITableRowSchema))

Rendering the edit view of the related DX type give me this error:

Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module ZPublisher.Publish, line 48, 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 64, 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 132, in update
  Module z3c.form.form, line 135, in updateWidgets
  Module z3c.form.field, line 277, in update
  Module z3c.form.browser.multi, line 63, in update
  Module z3c.form.browser.widget, line 171, in update
  Module z3c.form.widget, line 479, in update
  Module z3c.form.widget, line 131, in update
  Module z3c.form.widget, line 474, in value
  Module collective.z3cform.datagridfield.datagridfield, line 147, in updateWidgets
  Module z3c.form.widget, line 416, in updateWidgets
  Module z3c.form.widget, line 393, in applyValue
  Module collective.z3cform.datagridfield.datagridfield, line 265, in set
  Module z3c.form.object, line 227, in applyValue
  Module collective.z3cform.datetimewidget.converter, line 32, in toWidgetValue
AttributeError: 'NO_VALUE' object has no attribute 'year'

Is there anything missing in the initialization of is schema.Date() just not suitable with collective.z3c.datagridfield?

-aj

Solved.

Error only occurs on older instances without having had a default value at creation time.

-aj

1 Like