From: ShaoHe Feng <shaohef(a)linux.vnet.ibm.com>
The cherrpy HTTPError accepts message as string, it will generate a error
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(a)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'))
--
1.8.5.3