Module: check_mk
Branch: master
Commit: 436b43edcf888885fd2a12a23cac9c875e5f02df
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=436b43edcf8888…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Fri Jan 11 11:05:28 2019 +0100
Inline var_utf8() into single call site.
Change-Id: I1c20fbbe76e196cb446ead632bc52a5086bee359
---
cmk/gui/htmllib.py | 3 ++-
cmk/gui/http.py | 6 ------
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index 6a89fab..f6f2cf7 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -1133,7 +1133,8 @@ class html(HTMLGenerator):
def get_unicode_input(self, varname, deflt=None):
try:
- return self.request.var_utf8(varname, deflt)
+ val = self.request.var(varname, deflt)
+ return val.decode("utf-8") if isinstance(val, str) else val
except UnicodeDecodeError:
raise MKUserError(
varname,
diff --git a/cmk/gui/http.py b/cmk/gui/http.py
index 96dab22..f89a17f 100644
--- a/cmk/gui/http.py
+++ b/cmk/gui/http.py
@@ -152,12 +152,6 @@ class Request(object):
def has_var(self, varname):
return varname in self._vars
- def var_utf8(self, varname, deflt=None):
- val = self._vars.get(varname, deflt)
- if isinstance(val, str):
- return val.decode("utf-8")
- return val
-
def itervars(self, prefix=""):
return (item \
for item in self._vars.iteritems() \