Module: check_mk
Branch: master
Commit: 555f522fd89ffda1f9003e5e16f19463326f6567
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=555f522fd89ffd…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Feb 3 10:13:01 2011 +0100
Multisite: handle non-ascii chars in hostgroups
---
ChangeLog | 5 +++++
web/htdocs/htmllib.py | 13 +++++++++----
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c93718e..9819a6e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,9 +9,14 @@
same as incoming, errors and discards were swapped (thanks to
Paul Freeman)
+ Multisite:
+ * Fix encoding problem when host/service groups contain non-ascii
+ characters.
+
WATO:
* Fix too-long-URL problem in cases of many services on one host
+
1.1.9i6:
INCOMPATIBLE CHANGES:
* Removed out-dated checks blade_misc, ironport_misc and snia_sml. Replaced
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index d231791..d19f7bb 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -64,7 +64,10 @@ class uriinfo:
if i[0] not in omit ])
def attrencode(value):
- return cgi.escape(str(value), True)
+ if type(value) in [str, unicode]:
+ return cgi.escape(value)
+ else:
+ return cgi.escape(str(value), True)
# This function returns a str object, never unicode!
def urlencode_vars(vars):
@@ -342,11 +345,13 @@ class html:
def html_head(self, title):
if not self.req.header_sent:
self.req.write(
- '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+ u'''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html;
charset=utf-8">
- <title>%s</title>
- <link rel="stylesheet" type="text/css"
href="check_mk.css">''' % title)
+ <title>''')
+ self.req.write(title.encode("utf-8"))
+ self.req.write('''</title>
+ <link rel="stylesheet" type="text/css"
href="check_mk.css">''')
if config.custom_style_sheet:
self.req.write(' <link rel="stylesheet"
type="text/css" href="%s">' % config.custom_style_sheet)
self.req.write('''