[Zope] Getting select contents from parent object

Tino Wildenhain tino@wildenhain.de
Wed, 07 Aug 2002 16:48:19 +0200


Hi VanL,

if you start defining your zclass, simply put the name of the function
into the "value" field for property type "select"
This is all you need.

If you want to try out this while authoring the zclass, you have
to move the method to a place, where it can be seen from 
Control_Panel/Products,
like / (root)

Happy zoping

Tino



--On Mittwoch, 7. August 2002 08:27 -0600 VanL <Van@Lindbergs.org> wrote:

> 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
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )