Chris Withers wrote:
Evan Simpson wrote:
The value you're after is stored in the 'environ' section of the request. Unlike 'other' and 'cookies' keys, 'environ' keys can't generally be fetched as attributes or keys of REQUEST. You need to access them as REQUEST.environ['keyname'].
Heh, I thought so, I presume REQUEST.get won't get out of environ either?
I posted this in the collector and was told it behaved as expected (and would suck the key out of any of the sub-dictionaries)
What's the real story? ;-)
I'm looking at 2.2.0final.
From the comments in the code, it *ought* to look in the environment first.
def __getitem__/__getattr__ from HTTPRequest.py: """Get a variable value Return a value for the required variable name. The value will be looked up from one of the request data categories. The search order is environment variables, other variables, form data, and then cookies. """ However, looking in the code, it starts off by looking in "other", and doesn't look in "environ" at all. I suggest a patch to go right after the method's docstring: def __getitem__(self,key, default=_marker, # Any special internal marker will do URLmatch=regex.compile('URL[0-9]+$').match, BASEmatch=regex.compile('BASE[0-9]+$').match, ): """Get a variable value Return a value for the required variable name. The value will be looked up from one of the request data categories. The search order is environment variables, other variables, form data, and then cookies. """ #" + environ=self.environ + if environ.has_key(key): + return environ[key] other=self.other if other.has_key(key): if key=='REQUEST': return self return other[key] -- Steve Alexander Software Engineer Cat-Box limited http://www.cat-box.net