[Zope] 'selection' types question

Brown, Brian Brian.Brown@smawins.com
Thu, 23 Sep 1999 15:46:43 -0600


I was trying to figure out how to use the types 'selection' and 'multiple
selection' and found the following:

In <zope dir>/lib/python/ZClasses/Property.py, the following code shows that
these type should result in an HTML Select box, 



        if t=='selection':
            return ('''
            <!--#if "_.has_key('%(id)s')"-->
            <select name="%(id)s">
              <!--#in "_.string.split('%(select_variable)s')"-->
                <option
                  <!--#if "_['sequence-item']=='%(id)s'"-->
                  SELECTED<!--#/if-->
                  ><!--#var sequence-item--></option>
              <!--#/in-->
            </select>
            <!--#else-->
              No value for %(id)s
            <!--#/if-->'''
                    % p
                    )

        return ''

...but I couldn't figure out how to get any data in it. Then I found in
<zope dir>/lib/python/OFS/PropertySheets.py:

       if type in ('selection', 'multiple selection'):
            if not value:
                raise 'Bad Request', (
                    'The value given for a new selection property '
                    'must be a variable name<p>')
            prop['select_variable']=value
            if type=='selection': value=None
            else: value=[]
        setattr(self, id, value)

This told me that I should be putting a variable name for the value, and
that worked fine. The problem them comes with 'multiple select' boxes.
Nothing displays, and I think that is due to there being no analog for the
first code snippet above. Can someone with more Zope Zen than I confirm
this? I think it's a bug, and if so I'll put it in the Collector.

btw, this is released Zope 2.0.0 on linux, source release.

Thanks!

Brian