Module: check_mk
Branch: master
Commit: 57936740054798f2571089f071485a9dc0652e9e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57936740054798…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jan 3 12:53:57 2019 +0100
Do not build closures by hand. ;-)
Change-Id: I9150e2a37175ae4a1f38724b236057d8853699bd
---
cmk/gui/table.py | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)
diff --git a/cmk/gui/table.py b/cmk/gui/table.py
index 21d1c35..a179cc0 100644
--- a/cmk/gui/table.py
+++ b/cmk/gui/table.py
@@ -68,8 +68,7 @@ def table_element(table_id=None, title=None, **kwargs):
class Table(object):
def __init__(self, table_id=None, title=None, **kwargs):
super(Table, self).__init__()
- self.next_func = id
- self.next_args = None
+ self.next_func = lambda: None
self.next_header = None
# Use our pagename as table id if none is specified
@@ -106,22 +105,18 @@ class Table(object):
def row(self, *posargs, **kwargs):
self._finish_previous()
- self.next_func = self._add_row
- self.next_args = posargs, kwargs
+ self.next_func = lambda: self._add_row(*posargs, **kwargs)
def text_cell(self, *args, **kwargs):
- kwargs["escape_text"] = True
- self.cell(*args, **kwargs)
+ self.cell(*args, escape_text=True, **kwargs)
def cell(self, *posargs, **kwargs):
self._finish_previous()
- self.next_func = self._add_cell
- self.next_args = posargs, kwargs
+ self.next_func = lambda: self._add_cell(*posargs, **kwargs)
def _finish_previous(self):
- if self.next_args is not None:
- self.next_func(*self.next_args[0], **self.next_args[1])
- self.next_func = None
+ self.next_func()
+ self.next_func = lambda: None
def _add_row(self, css=None, state=0, collect_headers=True, fixed=False, **attrs):
if self.next_header: