[Zope] selection list confusion ...

Darran Edmundson Darran.Edmundson@anu.edu.au
Sat, 12 Feb 2000 20:27:24 +1100


Go to any property sheet and an explanatory blurb appears
which ends with an explanation of selection variables:

  For "selection" and "multiple selection" properties enter 
  the name of a selection variable in the "Value" field. The 
  selection variable is a property or method that returns a 
  list of strings from which the selection(s) can be chosen.

Grabbing the list from an acquired property (call it "Choices")
of type "lines" works but I'm having two difficulties.

1) As per suggestions, I have created a "globals" folder
   in my zope root to which I have added a number of needed
   properties, including Choices.  (Previously I had set 
   these properties in the root which cannot be easily moved 
   to another Zope site.)  Is it possible to reference Choices
   in the value field of a selection box property?

2) I created a simple root level DTML method GetChoices to 
   return a list of strings:
         <dtml-with globals><dtml-var Choices></dtml-with>

   Rendering this method yields:
      ['choice1','choice2','choice3']
   but looks like a python list but obviously Zope feels
   differently when GetChoices is used as the value field
   when trying to add a selection property:

       Zope Error
       Zope has encountered an error while publishing this resource. 

       Error Type: InError
       Error Value: Strings are not allowed as input to the in tag.

Method 2 is less than optimal because it means I need to clutter
up my root with these one-line methods that simply return a list
of choices for a single selection box.  I'd rather be able to
reference a property in the globals folder.  That said, for future
reference I would like to know how to write a selectionlist method.

As always, any help is much appreciated.

Cheers,
Darran.