[Zope] Re: problem with sort_order (when seting up zwikitracker)

Robert Rottermann robert@redcor.ch
Sun, 24 Feb 2002 10:58:36 +0100


Hi Simon,
I was stumbling over that problem also and started to investigate it.
The outcome is, that in Zope 2.4 getattr(REQUEST, variable, default) does
not return the default but dies when variable does not exist.
This "feature" was changed back to its expected behavior in 2.5

I checked 2.43 and 2.44b1
to test it just create a dtml method with:
<dtml-var "_.getattr(REQUEST, 'abc', '')">

What I did to solve the problem is I changed al the "offending" dtl-code to
python scripts where I first test for the existence of a key. That makes
much nicer code anyhow.

Robert

----- Original Message -----
From: "Simon Michael" <simon@joyful.com>
To: <zope@zope.org>
Sent: Sunday, February 24, 2002 5:02 AM
Subject: [Zope] Re: problem with sort_order (when seting up zwikitracker)


> Aaah! Don't expose my dtml quackery here!
>
>
> Well, one or two others reported the same problem and I'd love to
> understand it. How can
>
>   _.getattr(REQUEST,'sort_order','')
>
> ever give a KeyError ?
>
> puzzled,
> -Simon
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>