Module: check_mk
Branch: master
Commit: 38e45a4d81ba95d3f38633ed8e96d9b1df6d04e8
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=38e45a4d81ba95…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jan 3 10:13:12 2019 +0100
Nuked ugly global table stack.
Change-Id: I55b8dbdf71f4dc2305d9c36d8c2b79e2bf999339
---
cmk/gui/table.py | 28 ++++------------------------
1 file changed, 4 insertions(+), 24 deletions(-)
diff --git a/cmk/gui/table.py b/cmk/gui/table.py
index 90e80bb..780359b 100644
--- a/cmk/gui/table.py
+++ b/cmk/gui/table.py
@@ -35,34 +35,14 @@ from cmk.gui.i18n import _
from cmk.gui.globals import html
from cmk.gui.htmllib import HTML
-tables = []
-
@contextmanager
def open_table(table_id=None, title=None, **kwargs):
- tab = Table(table_id, title, **kwargs)
- tables.append(tab)
+ table = Table(table_id, title, **kwargs)
try:
- yield tab
+ yield table
finally:
- tables.pop().end()
-
-
-def row(*posargs, **kwargs):
- tables[-1].row(*posargs, **kwargs)
-
-
-def text_cell(*posargs, **kwargs):
- tables[-1].text_cell(*posargs, **kwargs)
-
-
-def cell(*posargs, **kwargs):
- tables[-1].cell(*posargs, **kwargs)
-
-
-# Intermediate title, shown as soon as there is a following row.
-def groupheader(title):
- tables[-1].groupheader(title)
+ table.end()
def update_headinfo(num_rows):
@@ -138,7 +118,7 @@ class Table(object):
def text_cell(self, *args, **kwargs):
kwargs["escape_text"] = True
- cell(*args, **kwargs)
+ self.cell(*args, **kwargs)
def cell(self, *posargs, **kwargs):
self.finish_previous()