Ticket #12314 (closed Bug: fixed)

Opened 4 years ago

Last modified 4 years ago

plone.app.users: Member data fields cannot be set to empty string

Reported by: reinhardt Owned by:
Priority: trivial Milestone: 4.x
Component: General Version:
Keywords: zope.app.form, plone.app.users, zope.schema, member data Cc:

Description

On /@@personal-information, when I set a field (say home_page) to the empty string, it does not get saved and the old value remains.

The TextWidget from zope.app.form checks if its value is missing. If yes, it sets it to self.context.missing_value. self.context is a TextLine field from zope.schema, which inherits the default missing_value from Field, which is None.

Thus, when plone.app.users tries to set the property home_page, it finds a None value and skips updating.

I suggest that TextWidget should have the empty string as missing_value, but I'm not too familiar with this code and could be wrong.

Change History

comment:1 Changed 4 years ago by kleist

  • Priority changed from minor to trivial
  • Component changed from Unknown to Infrastructure
  • Milestone set to 4.x

upstream?

comment:2 Changed 4 years ago by reinhardt

Sorry, the last line should read

"I suggest that TextLine should have the empty string as missing_value"

Bit confused by all the eggs involved here. :P

So, should I report to the zope.schema developers? Or shouldn't rather plone.app.users delete the current value of a field when it finds a missing_value?

comment:3 Changed 4 years ago by kleist

  • Summary changed from Member data fields cannot be set to empty string to plone.app.users: Member data fields cannot be set to empty string

comment:4 Changed 4 years ago by maurits

  • Status changed from new to closed
  • Resolution set to fixed

Thanks for the report.

I experimented a bit and could only fix it by adding this code a few times in the related browser views:

if value is None:
    value = ''

See  https://github.com/plone/plone.app.users/commit/8a486841352086a43c4d716f253636549aee17de

Fixed. Should end up in plone.app.users 1.1.3.

comment:5 Changed 3 years ago by davisagli

  • Component changed from Infrastructure to General
Note: See TracTickets for help on using tickets.