I've been playing around with Colubrid and noticed that I'm getting a
KeyError when I shouldn't. Further inspection showed that whenever I
call something like
self.request.args['test']
It's actually looking for that key /twice/, but on the second time, the
dictionary is blank.
Here's what I've done:
class MultiDict:
def __getitem__(self,key):
try:
print "%r and %r" % (self, key)
list_ = dict.__getitem__(self, key)
except KeyError:
raise "Key %r not found in %r" % (key, self)
try:
return list_[-1]
except IndexError:
return []
In my application:
r = HttpResponse(self.request.args['test'])
return r
The url:
http://localhost:8080/?test=hello
The webpage renders, but the exception is thrown for the second round.
I've tested this for both ObjectApplication and WebpyApplication. Any
clue why this is happening?
Thanks!