ItemDisplayWidget wrong truth testing

Bug #159232 reported by Lorenzo Gil Sanchez
2
Affects Status Importance Assigned to Milestone
Zope 3
Won't Fix
Undecided
Lorenzo Gil Sanchez
zope.app.form
Fix Committed
Medium
Christian Theune
zope.formlib
Fix Released
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.

Revision history for this message
Lorenzo Gil Sanchez (lgs) wrote :
Changed in zope3:
assignee: nobody → lgs
status: New → In Progress
Revision history for this message
Lorenzo Gil Sanchez (lgs) wrote :
Changed in zope3:
status: In Progress → Won't Fix
Revision history for this message
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
Revision history for this message
Christian Theune (ctheune) wrote :

Fixed for zope.formlib 4 in revision 111335.

Changed in zope.formlib:
status: In Progress → Fix Committed
Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.