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

Dieter Maurer dieter@handshake.de
Mon, 17 Sep 2001 20:06:52 +0200 (CEST)


Trevor Toenjes writes:
 > The DTMLMethod and Python script get the same error now.
 > They are in the methods tab of 'myZclass'.
 > ERROR: Cannot locate object at:
 > http://zope/folder_of_myZclass/myZclass_instanceX
Should Zope be able to locate the object there?

 > > <dtml-with folder_of_anotherZclass>
 > >     <dtml-in "objectIds('anotherZclass')">
 > >         <dtml-var sequence-index>
 > >     </dtml-in>
 > > </dtml-with>
This will return a string. Sure, you do not want that!

 > OR
 > 
 > > > myList=[]
 > > > for id in folder_of_anotherZclass.objectValues('anotherZclass'):
 > > >     myList.append(id)
 > > > return myList
This should return a NameError unless you passed in
"folder_of_anotherZClass" as parameter (what you did not
as you can not pass parameters...).

Try:

  return context.folder_of_anotherZclass.objectIds('anotherZclass')


Dieter