[Zope] Help with Page Counter (Python script), please
Maik Jablonski
maik.jablonski@uni-bielefeld.de
Tue, 23 Apr 2002 13:38:06 +0200
On Tue, 23 Apr 2002 09:44:12 +0200 "Uwe Schuerkamp"
<uwe.schuerkamp@nionex.net> wrote:
> I'm trying to implement a simple page request counter by checking for
> a property named "requestCount" in a DTML method, adding the property
> if not found, incrementing it otherwise and returning the new value.
>
> I'm using the following python script:
>
> request = container.REQUEST
>
> o = container.index_html
> this script lives in the top level of my Zope installation.
>
> When I try to get a hit counter by including the script output as a
> DTML-var like this:
>
> <dtml-var incRequestCount>
>
> in any subfolder the property of the Zope root folder is incremented
> (where the Python script lives), but not the container of the current
> object / container / folder whatever.
you should use 'context' instead of 'container'. have a look at the
description of the python-script-bindings (bindings-tab)...
request = context.REQUEST
...
o = context.index_html
greetings, maik.