[Joseph A Knapka]
"Thomas B. Passin" wrote:
Yes, I understand all that. My question, to put it very explicitly, is this:
Since I'm checking to see whether REQUEST has a key 'xyz', and setting it if not, then by the time we get to the <dtml-var xyz> line, REQUEST definitely *does* have an 'xyz' key; and since REQUEST is undoubtedly in the namespace (right?), how can <dtml-var xyz> possibly result in a KeyError?
Sounds mysterious, all right. Let's get clear on a few things, then maybe Dieter or someone else will know the answer. 1) Is it the case that nothing else every happens on your page between the setting of the xyz property in the REQUEST and the <dtml-var xyz> rendering? 2) When you say that you "sometimes" get an error, can you tell what has preceded it when you do and do not get an error? 3) Add a line after you assign the variable, like this: <dtml-if expr="REQUEST.has_key('xyz')"> The property already exists, and its value is ==<dtml-var "REQUEST.xyz">==<br> <dtml-else> <dtml-call expr="REQUEST.set('xyz','Hello world')"> We just set the property<br> </dtml-if> This will let you know if there is a property with that name whose value is empty, or whether it is in fact getting set. The "== ==" characters are ther to let you see if there is an empty string. It may seem obvious that it has to get set, but best to cover all possiblitites when strange things happen. You could also add <dtml-var REQUEST> before and after to see whether the xyz property did get into the REQUEST after all. Let us know the results. Cheers, Tom P