[Zope-Coders] Bug in 2.7's PropertyManager

Richard Jones richard@commonground.com.au
Tue, 22 Apr 2003 18:07:02 +1000


In 2.7, PropertyManager defaults missing values for "multiple 
selection" properties to an empty string, ''. This has been the case 
for as long as I can remember, and it's bugged me every time I ran into 
it (never had the chance to look into it until now though). I'd like to 
change the behaviour so that it defaults to an empty _list_ if the type 
of the property is in "multiple selection". Following the code through,

1. My property is specified as having type "multiple selection"
2. The ZPublisher type for this is "lines" (*shrug* that's what 
PropertyManager's form sets it to)
3. This is handled just fine if the form actually contains input for 
the property, but if it doesn't then PropertyManager's 
manage_editProperties() defaults the value to ''
4. It then calls _updateProperty() which uses the type converters from 
ZPublisher to convert the empty value to the correct value/type, but 
ZPublisher doesn't know about "multiple selection"

I believe the fix is to add a "multiple selection" converter to 
ZPublisher which just uses the field2lines converter. This appears to 
work in practise. I'll make the change and commit it if there's no 
complaints.


     Richard