[ZDP] BackTalk to Document The Zope Book (2.5 Edition)/Extending Zope

nobody@nowhere.com nobody@nowhere.com
Sat, 31 Aug 2002 02:44:28 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZopeBook/current/CustomZopeObjects.stx#3-44

---------------

      As you can see, this sheet looks very much like the *Properties* view
      on Zope objects.  Here, you can create new properties on this sheet.
      Properties on Property Sheets are exactly like Properties on Zope
      objects, they have a name, a type, and a value.  

        % Anonymous User - Aug. 31, 2002 2:44 am:
         If I create a "selection" property, then what is the context in which it searches for the method? Is the
         context any different between the master class and the instances? Should it be?
         An example of my problem follows. Create a new ZClass object called "Parrot" in a convenient product folder.
         Create a method on "Parrot" called "status_list". I suggest a simple Python script will do, such as one that
         immediately returns a list of strings (like return ["passed on", "ceased to be", ...] etc). Now create a new
         common instance property sheet for the class, called "properties". In this property sheet, add a property
         named "status" with a type of "selection" and a value of "status_list". Note that the value appears as "no
         value for status_list" when added. Now create an instance of "Parrot" somewhere and inspect its properties.
         Note that the select list is populated with the list of strings returned by the "status_list" method.
         It seems reasonable to me that you'd want these two cases to behave identically, not differently. In what
         part of the product folder should such a method/script be placed such that it is equally accessible to the
         class property sheets and the instance property sheets?