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
diff -rc webob-trunk/webob/__init__.py webob/webob/__init__.py
*** webob-trunk/webob/__init__.py Sat Feb 9 19:27:03 2008
--- webob/webob/__init__.py Sat Feb 9 19:27:07 2008
***************
*** 480,486 ****
self.__dict__['charset'] = charset
if unicode_errors is not NoDefault:
self.__dict__['unicode_errors'] = unicode_errors
! if decode_param_names is NoDefault:
self.__dict__['decode_param_names'] = decode_param_names
def __setattr__(self, attr, value, DEFAULT=[]):
--- 480,486 ----
self.__dict__['charset'] = charset
if unicode_errors is not NoDefault:
self.__dict__['unicode_errors'] = unicode_errors
! if decode_param_names is not NoDefault:
self.__dict__['decode_param_names'] = decode_param_names
def __setattr__(self, attr, value, DEFAULT=[]):
_______________________________________________
Paste-users mailing list
[email protected]
http://webwareforpython.org/cgi-bin/mailman/listinfo/paste-users