Module: check_mk
Branch: master
Commit: 4693867030c45b6918e09df2480b7c750473043d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=4693867030c45b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Mar 2 08:59:35 2015 +0100
#2080 FIX Fixed UnicodeDecodeError when using a localized GUI on notification
configuration page
---
.werks/2080 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/htmllib.py | 11 +++++++----
3 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/.werks/2080 b/.werks/2080
new file mode 100644
index 0000000..a72afaa
--- /dev/null
+++ b/.werks/2080
@@ -0,0 +1,10 @@
+Title: Fixed UnicodeDecodeError when using a localized GUI on notification configuration
page
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1425283147
+
+
diff --git a/ChangeLog b/ChangeLog
index cf39199..8229f32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -299,6 +299,7 @@
* 2025 FIX: Fixed exception when synchronising custom ldap attributes in distributed
WATO setup
* 2026 FIX: Fixed exception when using umlauts in notification plugin
descriptions...
* 2078 FIX: Fixed exception with some snapshots when using a localized GUI...
+ * 2080 FIX: Fixed UnicodeDecodeError when using a localized GUI on notification
configuration page
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 6fedc3c..e4dbbb3 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -154,12 +154,15 @@ class html:
for tf in self.transformations:
text = tf(text)
- if type(text) == unicode:
- text = text.encode("utf-8")
-
if self.plugged:
self.plugged_text += text
else:
+ # encode when really writing out the data. Not when writing plugged,
+ # because the plugged code will be handled somehow by our code. We
+ # only encode when leaving the pythonic world.
+ if type(text) == unicode:
+ text = text.encode("utf-8")
+
self.lowlevel_write(text)
def plug(self):
@@ -1270,7 +1273,7 @@ class html:
def debug(self, *x):
import pprint
for element in x:
- self.lowlevel_write("<pre>%s</pre>\n" %
pprint.pformat(element))
+ self.lowlevel_write("<pre>%s</pre>\n" %
self.attrencode(pprint.pformat(element)))
def has_cookie(self, varname):