i've attached another small patch that fixes a small bug in UnicodeMultiDict.
it assumed that cgi.FieldStorage always filled in its filename attribute, but
for application/x-www-form-urlencoded parts, the filename attribute is
actually None. more at the bottom of http://python.org/doc/lib/node560.html.
On Sat, 9 Feb 2008, Ryan Barrett wrote:
hi all! i'm trying to understand webob.Request's decode_param_names keyword
arg, but i'm not having much luck. i've attached a patch against trunk that i
think fixes one bug, but even with the fix, i'm not sure i understand the
intent behind the code.
decode_param_names is passed through to decode_keys in UnicodeMultiDict. if
it's True, keys returned by methods like keys(), items(), etc. are decoded.
however, keys passed in to methods like __getitem__ and __setitem__ are
expected to be encoded.
that means that expressions like umd[umd.keys()[0]] fail with a KeyError,
which seems counter-intuitive. was that really the intent?
-Ryan
-Ryan
*** webob-trunk/webob/multidict.py Sat Feb 9 19:27:03 2008
--- webob/webob/multidict.py Sun Feb 10 10:52:04 2008
***************
*** 288,294 ****
value = copy.copy(value)
if self.decode_keys:
value.name = value.name.decode(self.encoding, self.errors)
! value.filename = value.filename.decode(self.encoding, self.errors)
else:
try:
value = value.decode(self.encoding, self.errors)
--- 288,296 ----
value = copy.copy(value)
if self.decode_keys:
value.name = value.name.decode(self.encoding, self.errors)
! if value.filename:
! value.filename = value.filename.decode(self.encoding,
! self.errors)
else:
try:
value = value.decode(self.encoding, self.errors)
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users