[Bug] strange "InstanceDict" behaviour (was: [Zope] Why doesn't setting REQUEST keys work inside <dtml-with REQUEST> ?)

Dieter Maurer dieter@handshake.de
Fri, 5 Apr 2002 23:58:31 +0200


Don Hopkins writes:
 > ... wrong value shown inside "<dtml-with REQUEST>" ...

I have a work around for you:

  <dtml-with REQUEST mapping>

will work as expected.


However, I do not understand this behaviour:

   The difference between "<dtml-with REQUEST>" and
   "<dtml-with REQUEST mapping>" is that in the first
   case "REQUEST" is wrapped into an "InstanceDict" before
   it is pushed onto the namespace while in the second case
   it is pushed itself (unwrapped).

   "InstanceDict" is a wrapper that maps "getitem" onto the
   wrapped object's "getattr".

   But, because "REQUEST" maps its "getattr" to its "getitem",
   there should not be a big difference.
   Should, as you see there is one....


I may look more closely into this tomorrow.


Dieter