[Zope] Getting select contents from parent object

VanL Van@Lindbergs.org
Wed, 07 Aug 2002 08:27:36 -0600


Hello,

I have an object with properties, and I would like to add to it a 
select-box as a property.  However, I want the possible selections to be 
defined by a containing object.  That sounds sort of confusing, so let 
me provide an example:

In my Zope instance, I have a folderish object, 'apples'.  The 'apples' 
folder has a function, 'list_apple_types', which returns a list: 
['good', 'bad', 'red', 'granny'].
Now I want to create an apple object and put it in this folder.  When I 
create the apple object, I want to be able to give it a select property 
where the function that returns the list of possible selections is the 
'list_apple_types' folder of the parent folder.

The reason I want to do it this way is so that I only have to define 
that list once, and if I add a new type of apple to the list ('rotten'), 
then I don't have to go through and add this new possible select value 
to all of the apple objects in the apples folder.

Can anyone tell me how to do this?  I have been playing around and 
reading the docs, but I can't find a way to do this.  

Thanks very much,

VanL