[Zope] DTML namespace puzzle

Dieter Maurer dieter@handshake.de
Sun, 28 Jan 2001 21:43:02 +0100 (CET)


Ron Bickers writes:
 > I have a Python Script (sendOrder) that calls a DTML method (orderMessage)
 > as follows:
 > 
 >   container.orderMessage(num=num, SESSION=SESSION)
 > 
 > orderMessage contains the following:
 > 
 >   <dtml-with "SESSION['info']" mapping>
 >   Order Number: <dtml-var num>
 >   Blah blah other session variables that work fine.
 >   </dtml-with>
 > 
 > I get a KeyError on num.  If I modify orderMessage to contain the following,
 > it works:
 > 
 >   <dtml-let num=num>
 >   <dtml-with "SESSION['info']" mapping>
 >   Order Number: <dtml-var num>
 >   Blah blah other session variables that work fine.
 >   </dtml-with>
 >   </dtml-let>
 > 
 > This seems strange to me.  What am I missing?
I failed to reproduce this in my Zope CVS.

It is puzzling indeed!

Does "SESSION['info']" has a key "num" or do you expect
to access the "num" passed as parameter?
In this case, it might have something to do with permissions,
as Zope sometimes turns insufficient permissions into KeyError.
However, I expect your "SESSION['info']" is a standard dictionary
and then access should by unprotected.

Dieter