[Zope3-dev] bug setting value to None via edit form

Garrett Smith garrett@mojave-corp.com
Sat, 12 Jul 2003 15:22:00 -0500


The problem shows up clearly for Int field types: change a non None
value (e.g. 12) to None by clearing the field and submitting the form.
The field is updated, but the form displays the old value.

The problem is at line 174 of zope/app/form/utility in setUpWidget. It's
currently:

    if value is not None and (force or not widget.haveData()):
        widget.setData(value)

 I believe it should be:

    if force or not widget.haveData():
        widget.setData(value)

None is a valid field value and widgets should be able to handle them.

I'd make the change (pending approval) but seemingly unrelated tests are
blowing up...staying clear.

 -- Garrett