[Zope] PropertySheet Question

Chris Withers chrisw@nipltd.com
Mon, 17 Jul 2000 16:22:36 +0100


Darin Lee wrote:
> I want to do something very simple: I have a ZClass propertysheet with an integer property called "views"
> Every time I load the page, I would like to increment this value by one, and write it back to the propertysheet.
> (Yep, a good old-fashioned access counter)

Access counter in ZODb = very bad idea

It's a transactional database with rollback capability so it will grow
each time you increment your counter!

> Sounds easy right?? Well, I can't seem to figure it out. Every time I get a little farther with Zope, something "trivial" like this completely knocks me for a loop and sends me hunting through piles of howto's for hours! argh...how hard can it be??

ZClasses are a little harsh on occasion....

> Got this from the help page (hopefully on the right track)...
> manage_changeProperties(self, REQUEST=None, **kw):
> 
> However, there is no clear example of how to call without a REQUEST object.

Try this:

manage_changeProperties(views=yourobject.getProperty(views)+1)

Where will you be calling this from?

cheers,

Chris