Module: check_mk
Branch: master
Commit: 26cf6b58de7f4470249aa6dd9c4150f16f67035f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=26cf6b58de7f44…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Jun 28 17:47:59 2011 +0200
Fix handling of None in htmllib.set_var()
---
web/htdocs/htmllib.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index b1099d9..7b3cccc 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -105,6 +105,8 @@ def urlencode_vars(vars):
def urlencode(value):
if type(value) == unicode:
value = value.encode("utf-8")
+ elif value == None:
+ return ""
ret = ""
for c in value:
if c == " ":
@@ -658,7 +660,10 @@ class html:
return val.decode("utf-8")
def set_var(self, varname, value):
- self.req.vars[varname] = value
+ if value == None:
+ self.del_var(varname)
+ else:
+ self.req.vars[varname] = value
def del_var(self, varname):
if varname in self.req.vars: