[Kimchi-devel] [PATCH V2] bug fix: we should pass str to cherrpy HTTPErorr

Aline Manera alinefm at linux.vnet.ibm.com
Tue Apr 1 19:17:58 UTC 2014


Reviewed-by: Aline Manera <alinefm at linux.vnet.ibm.com>

On 04/01/2014 09:20 AM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> The cherrpy HTTPError accepts message as string, it will generate a error

typo: cherrpy

I can fix before applying

> page, and encode this whole page.
>
> ERROR:cherrypy.error:[01/Apr/2014:17:46:28] ENGINE
> Traceback (most recent call last):
>    File
> "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py",
> line 1302, in communicate
>      req.respond()
>    File
> "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py",
> line 831, in respond
>      self.server.gateway(self).respond()
>    File
> "/usr/lib/python2.7/site-packages/cherrypy/wsgiserver/wsgiserver2.py",
> line 2126, in respond
>      chunk = chunk.encode('ISO-8859-1')
> UnicodeEncodeError: 'latin-1' codec can't encode characters in position
> 529-536: ordinal not in range(256)
>
> Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
> ---
>   src/kimchi/auth.py | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
> index 3b33d7f..63e11c4 100644
> --- a/src/kimchi/auth.py
> +++ b/src/kimchi/auth.py
> @@ -238,4 +238,4 @@ def kimchiauth(admin_methods=None):
>           cherrypy.response.headers['WWW-Authenticate'] = 'Basic realm=kimchi'
>
>       e = InvalidOperation('KCHAUTH0002E')
> -    raise cherrypy.HTTPError(401, e.message)
> +    raise cherrypy.HTTPError(401, e.message.encode('utf-8'))




More information about the Kimchi-devel mailing list