[Zope] ZClass hitCounter

Michel Pelletier michel@digicool.com
Sun, 16 May 1999 00:23:25 -0400


> -----Original Message-----
> From: Tom Deprez [mailto:tom.deprez@village.uunet.be]
> Sent: Saturday, May 15, 1999 6:48 AM
> To: zope@zope.org
> Subject: [Zope] ZClass hitCounter
> 
> 
> Ok, I've managed to get the increment of the counter from an 
> instance :
> 
> <!--#with counter-->
> <!--#call
> propertysheets.propHitCounter.manage_changeProperties(hitCount
> =hitCount+1)--
> >
> <!--#var counter-->
> <!--/#with-->

I assume that in your code you have quotes around that expression,
otherwise it wont work.

> 
> Now, I want to have a method 'inc' in the product HitCounter which
> increments the hitCount...
> 
> how to get this done? I can't get it to work.... I don't even 
> know how to
> call this method, because : 1. nothing happes, or 2. I can system is
> unavailable... with
> 

It apears that Howard Shaw helped you with the techhnical details here,
so I just have a bit of a warning you might want to avoid.  If your
counter is incrimented on each page access, then your object database
will grow on each hit.  Because the object database stores revisions of
objects, each new inciment of the property will append a new revision on
the ned of the database.  For a million hit per day website, this means
a million new objects will be added to the database.  Definately
performance prohibitive.

If you want to make a Counter product, I would suggest writing part of
it in python, and making the actual hit count a volitle object.  This
would require some caching logic (to preserve the hit count across
system resets) and some other magic.  I believe someone a month or so
ago someone allready jumped through most of these hoops.  I would
suggest either using/modifing their code or working from it to write
your own.

-Michel


> 1.
> 
> <!--#with counter-->
> <!--#call increment-->
> <!--#var counter-->
> <!--/#with-->
> 
> 2.
> 
> <!--#with counter-->
> <!--#call "increment"-->
> <!--#var counter-->
> <!--/#with-->
> 
> And what do I've to place in the DTML method 'increment'....
> 
> Please, can somebody help me?
> 
> Tom.
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://www.zope.org/mailman/listinfo/zope
> 
> (For developer-specific issues, use the companion list,
> zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
>