KeyError in self.args.request

2 views
Skip to first unread message

joeto...@gmail.com

unread,
Jul 14, 2006, 11:41:04 PM7/14/06
to colubrid-users
Hello -

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!

Reply all
Reply to author
Forward
0 new messages