[Zope] - Can't make the DTML example work ;-(

Kent Polk kent@eaenki.nde.swri.edu
Sat, 19 Dec 1998 14:50:41


Hi Pavlos (Pavlos Christoforou), in <Pine.LNX.3.96.981219144251.20832C-100000@gaaros.msrc.sunysb.edu> on Dec 19 you wrote:

> When I tried it long ago I did:
> <!--#call expr="_['counter']=_['counter']+1"-->
>  I believe it worked but I can't remember for sure
> 

And I cheated. Used External methods. Two reasons :

1) it was easier to figure out
2) I could apply host restrictions on the increment
  (I didn't want certain hosts or users to increment it.)

def incr_property(self, name, value):
   if self.REQUEST['AUTHENTICATED_USER'] == 'me' or self.REQUEST['REMOTE_HOST'] == 'myhost' :
# and some more stuff that I won't go into
      return value
   else :
      value = value+1;
      self.manage_changeProperties({name: value})
      return value

Then increment and display (std footer inserts it if it exists) :
<!--#call "incr_property('hitcounter',hitcounter)"-->
<!--#var standard_html_footer-->

I keep the incr_property out of the footer because I only
want certain objects to increment it, but all objects that
can find that property to display it, thus display is in
the footer.

Kent