ItemDisplayWidget wrong truth testing

Bug #159232 reported by Lorenzo Gil Sanchez on 2007-11-01
2
Affects Status Importance Assigned to Milestone
Zope 3
Undecided
Lorenzo Gil Sanchez
zope.app.form
Medium
Christian Theune
zope.formlib
Medium
Christian Theune

Bug Description

The __call__ method of zope.app.form.browser.itemswidget.ItemDisplayWidget check if there is a value to render a default no value message. This check is wrong since it is testing for truth while I think it should test for None identity.

The reason I think it's wrong is that you may have an empty container for the value but this does not mean you don't have any value at all.

Example:

I have a vocabulary that returns the list of ICountries. Each country is a container for IState objects. The DisplayWidget for a field of type ICountry don't render the correct term if the country is empty.

Lorenzo Gil Sanchez (lgs) wrote :
Changed in zope3:
assignee: nobody → lgs
status: New → In Progress
Changed in zope3:
status: In Progress → Won't Fix
Christian Theune (ctheune) wrote :

Applied revised patch to avoid additional testing dependency in 3.12 branch rev 111334. I don't think this fixes all issues hidden in the code but it definitely improves the situation. (Why can't an empty string be a value? If I allow it another test breaks.)

Changed in zope.app.form:
assignee: nobody → Christian Theune (ct-gocept)
status: New → Fix Committed
Changed in zope.formlib:
assignee: nobody → Christian Theune (ct-gocept)
status: New → In Progress
Changed in zope.app.form:
importance: Undecided → Medium
Changed in zope.formlib:
importance: Undecided → Medium
Christian Theune (ctheune) wrote :

Fixed for zope.formlib 4 in revision 111335.

Changed in zope.formlib:
status: In Progress → Fix Committed
Tres Seaver (tseaver) wrote :

Fix released with zope.formlib 4.0.3:

 http://pypi.python.org/pypi/zope.formlib/4.0.3

Changed in zope.formlib:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers