BackTalk to Document The Zope Book (2.6 Edition)/Extending Zope

[email protected]
Newsgroups gmane.comp.web.zope.zdp
Message-ID <[email protected]>
A comment to the paragraph below was recently added via http://zope.org/Documentation/Books/ZopeBook/2_6Edition/CustomZopeObjects.stx#3-77

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

      Here is an example of an implementation of the *isHungry* method in
      Python::

        ## Script (Python) "isHungry"
        ##
        """
        Returns true if the animal hasn't eaten in over 8 hours
        """
        from DateTime import DateTime
        if (DateTime().timeTime() 
            - container.last_meal_time.timeTime() >  60 * 60 * 8):
            return 1
        else:
            return 0

        % hpaluch - Jan. 27, 2004 2:51 am:
         It is obvious how to read ZClasses property - using container.last_meal_time.

         But attempt to assign new value to property, i.e. container.last_meal_time = my_new_time
         will result in an error: attribute-less object (assign or del)

         It should be clarified. Now it seems that the only solution is to use manage_changeProperties(...) method.

_______________________________________________
ZDP maillist  -  [email protected]
http://mail.zope.org/mailman/listinfo/zdp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.