[Zope-dev] broken selection property support in z2.2

Brian Lloyd Brian@digicool.com
Tue, 27 Jun 2000 10:10:48 -0400


> I tried creating a zclass that had a property sheet with a 
> selection type,
> which i had reference a property of a given name.  I then went to the 
> root folder in zope and created that property as a lines type.  When
> i created an instance of my zclass though, it said "no value 
> for given_name".
> To fix this i changed the OFS/properties.dtml file to use the 
> same syntax
> as the properties.dtml in z2.1:
> 
>   <dtml-elif "type=='selection'">
>     <dtml-if "_.has_key(select_variable)">
>     <select name="<dtml-var id>">
>       <dtml-in "_[select_variable]">
> 
> It used to use hasProperty and getProperty methods.  I'm not 
> entirely sure
> why they were used, or what they are suppose to do differently, but it
> doesn't seem to work.

Scott,

The 'selection' and 'multiple selection' properties are 
really built with the idea that you use another property 
*of the same object* (rather than an acquired value) to 
bind the selection to. Your change works for your case, 
but if you try to bind to another property of the same 
ZClass you'll find that in your management screens that 
your selection property will fail (because it is looking 
in '_' for the value, which is the wrong place to look 
if you are expecting to find the value as another property 
of the same object.

Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com