Issue #730 resolved

missing unicode params after tools.decode

Anonymous created an issue

at /lib/ {{{ ... def decode_params(encoding): decoded_params = {} for key, value in cherrypy.request.params.items(): if hasattr(value, 'file'): # This is a file being uploaded: skip it decoded_params[key] = value elif isinstance(value, list): # value is a list: decode each element decoded_params[key] = [v.decode(encoding) for v in value] elif isinstance(value, unicode): pass else: # value is a regular string: decode it decoded_params[key] = value.decode(encoding)

# Decode all or nothing, so we can try again on error.
cherrypy.request.params = decoded_params

}}} this function is correct process everything except unicode,

it just bypass the unicode,

so we missing the unicode params after assign params back to request

can be fixed by using update {{{ cherrypy.request.params.update(decoded_params) }}} or just put back the unicode params {{{ elif isinstance(value, unicode): decoded_params[key] = value }}} or, maybe we just process all this in-place because this won't alter dict keys

Reported by

Comments (2)

  1. Log in to comment