Module: check_mk
Branch: master
Commit: c1ee08d96967925a6c7f84ec1c6d413e5f740c0a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c1ee08d9696792…
Author: Tom Baerwinkel <tb(a)mathias-kettner.de>
Date: Wed May 16 10:55:38 2018 +0200
Fix unicode errors introduced by the conversion from hash to hashlib
Change-Id: I3f75623f02fc331e35030c2bb8b3762477142ce7
---
web/htdocs/views.py | 6 +++---
web/htdocs/wato.py | 3 ++-
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 65e1b75..cbfdfca 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2884,10 +2884,10 @@ def docu_link(topic, text):
# Calculates a uniq id for each data row which identifies the current
# row accross different page loadings.
def row_id(view, row):
- key = ''
+ key = u''
for col in multisite_datasources[view['datasource']]['idkeys']:
- key += '~%s' % row[col]
- return hashlib.sha256(key).hexdigest()
+ key += u'~%s' % row[col]
+ return hashlib.sha256(key.encode('utf-8')).hexdigest()
def paint_stalified(row, text):
if is_stale(row):
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 294cb73..d6cb47d 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -3620,7 +3620,8 @@ class ModeDiscovery(WatoMode):
# may contain such chars, we need to use some encoded form of it. Simple
escaping/encoding
# like we use for values of variables is not enough here.
def _checkbox_name(self, check_type, item):
- return "_move_%s" % sha256("%s_%s" % (check_type,
item)).hexdigest()
+ key = u"%s_%s" % (check_type, item)
+ return "_move_%s" % sha256(key.encode('utf-8')).hexdigest()
#.