[Zope] Modifying a zclass property

Fernando Martins fmartins@hetnet.nl
Mon, 23 Jun 2003 13:16:43 +0200


Hello,

I was going through the zope book's chapter "Extending Zope" and I
implemented a method called feed (the animal in a ZooExhibit). This method
is not in the book, and I coded it as:

from DateTime import DateTime
context.propertysheets.ExhibitProperties.manage_changeProperties(last_meal_t
ime = DateTime())
return context.index_html()

This works, but my first (unsuccessfull) try was:

from DateTime import DateTime
context.last_meal_time = DateTime()
return context.index_html()

This gives an error:

Error Type: TypeError
Error Value: attribute-less object (assign or del)

Why is last_meal_time not an attribute of the instance? In another method,
isHungry, from the book, I can retrieve its value:

if (DateTime().timeTime() - context.last_meal_time.timeTime() >  60 * 60 *
8):

What's going on?

Also, is there any difference between using container and context for an
instance of a ZClass?

Thanks,
Fernando