[ZDP] BackTalk to Document Zope Developer's Guide (2.4 edition)/Zope Products

webmaster@zope.org webmaster@zope.org
Wed, 09 Oct 2002 04:52:26 -0400


A comment to the paragraph below was recently added via http://www.zope.org/Documentation/Books/ZDG/current/Products.stx#4-29

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

        In order to make your poll class work correctly as an 'Item'
        you'll need to make a few changes. You must add a 'meta_type'
        class attribute, and you may wish to add an 'id' parameter to
        the constructor::

          class PollProduct(..., Item):

              meta_type='Poll'
              ...

              def __init__(self, id, question, responses):
                  self.id=id
                  self._question = question
                  self._responses = responses
                  self._votes = {}
                  for i in range(len(responses)):
                      self._votes[i] = 0

          % Anonymous User - Sep. 30, 2002 9:55 am:
           I guess class PollProduct should have a title atrribute!?!

          % Anonymous User - Oct. 9, 2002 4:52 am:
           As I understand it: either a title='' attribute, so the class will never have a title, or add a title
           parameter to the __init__ and assign it to self.title.