[Kimchi-devel] [PATCH 2/2] bug fix: we should pass str to cherrpy HTTPErorr in low level version

Sheldon shaohef at linux.vnet.ibm.com
Tue Apr 1 12:19:17 UTC 2014


please ignore this patch.

On 04/01/2014 05:57 PM, shaohef at linux.vnet.ibm.com wrote:
> From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
>
> 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 | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/kimchi/auth.py b/src/kimchi/auth.py
> index 3b33d7f..8fc3125 100644
> --- a/src/kimchi/auth.py
> +++ b/src/kimchi/auth.py
> @@ -32,7 +32,7 @@ import time
>
>   from kimchi import template
>   from kimchi.exception import InvalidOperation, OperationFailed
> -from kimchi.utils import run_command
> +from kimchi.utils import run_command, safe_encode
>
>
>   USER_ID = 'userid'
> @@ -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, safe_encode(e.message))


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list