PropertySheet Question
Hi everyone, 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) 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?? 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. I want to increment views, and then write it back to the property sheet. That's all. Do I need to include the asterisks? Do I need to include the keyword "self?" It really doesn't say. Everything I have seen on Zope.org, references the Web context with a REQUEST object. Coming from the "Perl-CGI" world I can honestly say, Zope *feels* like it should be easier to develop with, but this learning curve is immense! Thanks for your patience, Darin Lee (Zope Newbie Extraordinaire) Darin M. Lee Analyst / Web Administrator Office of Automation Coordination Michigan Department of Environmental Quality Phone: 517.241.5214 leedm@state.mi.us
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
participants (2)
-
Chris Withers -
Darin Lee