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

webmaster at zope.org webmaster at zope.org
Tue Jan 27 02:51:44 EST 2004


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.



More information about the ZDP mailing list