[Zope] how-to: dynamically create a list for the Value of a zClass multiple-selection Type?

Trevor Toenjes zope@toenjes.com
Mon, 17 Sep 2001 14:24:51 -0400


after a couple days of posting...finally SOLVED with lots of different input
from others.!!!  Thank you to the community.
I still cant get it to work in DTML (any guidance on this?), but have
successfully created my first Python script.  very cool.

Python script 'the_list'
# create a multiple selection list for a zClass Property, by calling the
ID's of a different zClass('anotherZclass') in a
folder(folder_of_anotherZclass) within the site.
myList=[]
for id in
context.REQUEST['PARENTS'][1].folder_of_anotherZclass.objectIds('anotherZcla
ss_meta_type'):
    myList.append(id)
return myList

PARENTS controls where the target folder is in the site. (alter as
necessary)
>From within zClasses, it has to be hard-coded from what I have been told.
There is no way to do sloppy acquisition, dtml-zope-like.
Enter 'the_list' as your Value in the Property Sheet, and it should work.

Use caselet:  From "edit" in a zClass, dynamically render a selection list
of related content(other zClasses) from a folder.  The other zClasses can
now be linked to this zClass using the 'ID' in a list of related links.


one more step ahead,
-Trevor