Module: check_mk
Branch: master
Commit: 0f143221e711abec4d1e8a222aab33c0e4ac871e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0f143221e711ab…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 7 17:54:40 2014 +0200
htmllib: new functions for stashing current variables
---
web/htdocs/htmllib.py | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/web/htdocs/htmllib.py b/web/htdocs/htmllib.py
index 3de2f9f..4b7dacd 100644
--- a/web/htdocs/htmllib.py
+++ b/web/htdocs/htmllib.py
@@ -58,6 +58,7 @@ class html:
self.link_target = None
self.form_name = None
self.form_vars = []
+ self.var_stash = []
self.context_buttons_open = False
self.mobile = False
self.buffering = True
@@ -987,6 +988,12 @@ class html:
self.vars = dict([(k,v) for (k,v) in self.vars.iteritems() if not
k.startswith(prefix)])
self.listvars = dict([(k,v) for (k,v) in self.listvars.iteritems() if not
k.startswith(prefix)])
+ def stash_vars(self):
+ self.var_stash.append(self.vars.copy())
+
+ def unstash_vars(self):
+ self.vars = self.var_stash.pop()
+
def javascript(self, code):
self.write("<script
language=\"javascript\">\n%s\n</script>\n" % code)