[Zope] how-to: dynamically create a list for the Value of a zClass multiple-selection Type?
Dieter Maurer
dieter@handshake.de
Sun, 16 Sep 2001 22:46:42 +0200 (CEST)
Trevor Toenjes writes:
> When I instantiate myzClass, one of the myzClass properties is a
> multiple-selection list of all the instances of 'anotherZClass', in a
> specified folder. I want the 'id' because a method of myzClass is to create
> hotlinks to related 'anotherZClass'.
For properties of type "selection" or "multiple selection", the
"Value" field is abused. It does not specify the initial
property value but the so called "select_variable", in fact
a misnomer! What you put into the value field is rendered to
get the sequence of possible selection values.
It can be, for example, the id of a property, the id of a method
(DTML, external, whatever) or a (Python) script.
When rendered (called), it must return a sequence. This
sequence will be your selection values.
I recommend to write a Python script which returns
the result of calling "objectIds" with appropriate variables.
Use the script's id as value for your selection property.
Dieter