[Zope] REQUEST.set('n', n+1) broken on zope.org

Dieter Maurer dieter@handshake.de
Mon, 4 Dec 2000 21:24:16 +0100 (CET)


Richard Jones writes:
 > As the subject says, REQUEST.set('n', n+1) is broken on zope.org. The
 > following DTML will raise an AttributeError on __add__:
 > 
 > <dtml-call REQUEST.set('n', 1)>
 > <dtml-call REQUEST.set('n', n+1)>
There may be a simple explanation
(someone else already pointed out, that you need to use "...";
I expect, you did as otherwise, you would get a "KeyError"):

  There may be an object named "n" somewhere in the
  acquisition context. An object that does not define
  an "__add__" method.

As you probably know (or can reread in the documentation),
"REQUEST" has quite a low priority for lookups
(in fact, it is at the bottom of the acquisition context).
It is therefore easy to have a REQUEST definition overridden.
Use "REQUEST['n']+1" instead of "n+1".



Dieter