plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
254 stars 191 forks source link

Undecipherable exception when schema.Date field added to 2 fieldsets #2712

Closed djowett closed 1 year ago

djowett commented 5 years ago

Reporting here as I'm not sure where fix should be (supermodel, plone.app.z3cform or elsewhere?)

What I did:

I created a dexterity type like this (based on dexterity.membrane, but I don't think that's relevant)

from plone.supermodel.directives import fieldset
[...]

class IUserType(IMember):

    [lots of fields]

    fieldset('office-use',
        label=u"Office use",
        fields=[
            ....  
            'membership_start',
        ]
    )

    fieldset('membership',
        label=u"Membership",
        fields=[
            'membership_start',
            ...
        ]
    )

    directives.write_permission(membership_start='cmf.ManagePortal')
    membership_start = schema.Date(
        title=_(u'Membership Start Date'),
        required=False,
    )

What I expect to happen:

An exception I can understand!

What actually happened:

The form loads and saves OK with no value set on the field, but when membership_start has a date set, I get this error

2019-02-02 21:17:26 ERROR Zope.SiteErrorLog 1549142246.040.39607249462 http://localhost:8080/SportsChapDev/Members/++add++MyUser/@@z3cform_validate_field
Traceback (innermost last):
  Module ZPublisher.Publish, line 138, in publish
  Module ZPublisher.mapply, line 77, in mapply
  Module Products.PDBDebugMode.runcall, line 70, in pdb_runcall
  Module ZPublisher.Publish, line 48, in call_object
  Module plone.app.z3cform.inline_validation, line 33, in __call__
  Module z3c.form.group, line 100, in extractData
  Module z3c.form.group, line 67, in extractData
  Module z3c.form.form, line 148, in extractData
  Module z3c.form.field, line 303, in extract
  Module plone.app.z3cform.converters, line 65, in toFieldValue
AttributeError: 'list' object has no attribute 'split'
> /home/daniel/dev/Plone/buildout-cache-UCS2/eggs/plone.app.z3cform-3.0.8-py2.7.egg/plone/app/z3cform/converters.py(65)toFieldValue()
-> return date(*map(int, value.split('-')))

What version of Plone/ Addons I am using:

Plone 5.1.4 plone.supermodel 1.4.0 dexterity.membrane 2.0.1 plone.app.dexterity 2.5.1 plone.dexterity 2.6.1

jensens commented 1 year ago

I close the issue, because it addresses a Plone version that is no longer supported. If you think this is wrong please reopen the issue and assign a matching milestone.