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

Richard Jones richard@bizarsoftware.com.au
Wed, 06 Dec 2000 09:25:26 +1100


Dieter Maurer wrote:
> 
> 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"):

    Yeah, sorry my example code was wrong.


>   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".

  This fixed the problem, thanks. I'm only just getting back into Zope,
and I suppose acquisition hadda bite me at least once :)


     Richard

-- 
Richard Jones
richard@bizarsoftware.com.au
Senior Software Developer, Bizar Software (www.bizarsoftware.com.au)