Module: check_mk
Branch: master
Commit: 48e3ccf0e2e2d074663dc97551eb23a2ca7463ab
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=48e3ccf0e2e2d0…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Sep 27 18:24:09 2018 +0200
Refactor help
This poses a great amount of trouble, specially on the web interface.
Depending on context help is translated to help_ or help_txt
under request of many comments in source code it is even refactored to
title as it matches the html attribute title where it is used. Nevertheless
that changes gives quite many problems and maybe needs to be separated in a
different commit.
There is for the moment one API interface function `register_rule` in
watolib.py where the refactoring has not taken place, but is proposed to
skip the check on that function.
Change-Id: Iaf0f65e35a6ee441dcbb10169148a7e8cf5201ed
---
cmk/gui/availability.py | 12 +++----
cmk/gui/htmllib.py | 42 +++++++++-------------
cmk/gui/plugins/views/availability.py | 8 ++---
cmk/gui/plugins/views/icons/wato.py | 6 ++--
cmk/gui/plugins/views/painters.py | 10 +++---
cmk/gui/plugins/wato/utils/__init__.py | 12 +++----
cmk/gui/table.py | 16 ++++-----
cmk/gui/views.py | 10 +++---
cmk/gui/wato/__init__.py | 4 +--
cmk/gui/wato/pages/custom_attributes.py | 4 +--
cmk/gui/watolib.py | 30 ++++++++--------
omd/packages/omd/omd | 6 ++--
.../unit/cmk/gui/old/unittest_files/icon.unittest | 2 +-
.../gui/old/unittest_files/icon_button.unittest | 2 +-
.../gui/old/unittest_files/render_icon.unittest | 2 +-
.../old/unittest_files/render_icon_button.unittest | 2 +-
16 files changed, 80 insertions(+), 88 deletions(-)
Diff: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commitdiff;h=48e3ccf0e2…
Module: check_mk
Branch: master
Commit: ad0fa50023c4bc50042d27afe09ba4a88e121942
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ad0fa50023c4bc…
Author: Óscar Nájera <on(a)mathias-kettner.de>
Date: Thu Sep 27 13:40:50 2018 +0200
enable pylint redefined-builtin
Fix missing cases
CMK-845
Change-Id: Ia6893a740ec3fc420aaf3908ddd23942296d0d01
---
.pylintrc | 2 +-
cmk/gui/crash_reporting.py | 2 +-
cmk/gui/forms.py | 2 +-
cmk/gui/htmllib.py | 8 ++++----
cmk/gui/table.py | 2 +-
cmk/gui/wato/__init__.py | 6 +++---
tests/unit/cmk/gui/test_table.py | 6 +++---
7 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index 7c007bb..06bf549 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -63,7 +63,7 @@ disable=
# Enabling this would be nice, but not crucial. At the moment, we have quite
# a few violations (about 200 in roughly 50 modules), so we postpone fixing
# this.
- redefined-builtin,
+ # redefined-builtin,
#---------------------------------------------------------------------------
# Enabling this would be nice, but not crucial. Nevertheless, this would
# improve readability and involve some cleanups in our class hierarchy, so
diff --git a/cmk/gui/crash_reporting.py b/cmk/gui/crash_reporting.py
index 76f4274..9ec13a4 100644
--- a/cmk/gui/crash_reporting.py
+++ b/cmk/gui/crash_reporting.py
@@ -416,7 +416,7 @@ def show_gui_crash_details(info):
html.open_tr(class_="data even0")
html.td(_("HTTP Parameters"), class_="left")
html.open_td()
- html.debug_vars(vars=details["vars"], hide_with_mouse=False)
+ html.debug_vars(vars_=details["vars"], hide_with_mouse=False)
html.close_td()
html.close_tr()
_crash_row(_("Referer"), details.get("referer", _("Unknown")))
diff --git a/cmk/gui/forms.py b/cmk/gui/forms.py
index 02144c5..e3fee81 100644
--- a/cmk/gui/forms.py
+++ b/cmk/gui/forms.py
@@ -30,7 +30,7 @@ from cmk.gui.globals import html
from cmk.gui.exceptions import MKUserError
# A input function with the same call syntax as htmllib.textinput()
-def input(valuespec, varprefix, defvalue):
+def textinput(valuespec, varprefix, defvalue):
if html.form_filled_in():
value = valuespec.from_html_vars(varprefix)
else:
diff --git a/cmk/gui/htmllib.py b/cmk/gui/htmllib.py
index 01cfbd1..0997566 100644
--- a/cmk/gui/htmllib.py
+++ b/cmk/gui/htmllib.py
@@ -2906,13 +2906,13 @@ hy
self.end_foldable_container()
- def debug_vars(self, prefix=None, hide_with_mouse=True, vars=None):
- if not vars:
- vars = self.request.vars
+ def debug_vars(self, prefix=None, hide_with_mouse=True, vars_=None):
+ if not vars_:
+ vars_ = self.request.vars
hover = "this.style.display=\'none\';"
self.open_table(class_=["debug_vars"], onmouseover=hover if hide_with_mouse else None)
self.tr(self.render_th(_("POST / GET Variables"), colspan="2"))
- for name, value in sorted(vars.items()):
+ for name, value in sorted(vars_.items()):
if name in [ "_password", "password" ]:
value = "***"
if not prefix or name.startswith(prefix):
diff --git a/cmk/gui/table.py b/cmk/gui/table.py
index 084a8ec..d86f7e5 100644
--- a/cmk/gui/table.py
+++ b/cmk/gui/table.py
@@ -38,7 +38,7 @@ tables = []
@contextmanager
-def open(table_id=None, title=None, **kwargs):
+def open_table(table_id=None, title=None, **kwargs):
begin(table_id, title, **kwargs)
yield
end()
diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py
index 45ee473..9273668 100644
--- a/cmk/gui/wato/__init__.py
+++ b/cmk/gui/wato/__init__.py
@@ -10124,7 +10124,7 @@ class ModeEditAuxtag(ModeEditHosttagConfiguration):
forms.section(_("Topic") + "<sup>*</sup>")
html.help(_("Different taggroups can be grouped in topics to make the visualization and "
"selections in the GUI more comfortable."))
- forms.input(self._get_topic_valuespec(), "topic", changed_aux_tag.topic)
+ forms.textinput(self._get_topic_valuespec(), "topic", changed_aux_tag.topic)
# Button and end
forms.end()
@@ -10269,7 +10269,7 @@ class ModeEditHosttagGroup(ModeEditHosttagConfiguration):
forms.section(_("Topic") + "<sup>*</sup>")
html.help(_("Different taggroups can be grouped in topics to make the visualization and "
"selections in the GUI more comfortable."))
- forms.input(self._get_topic_valuespec(), "topic", self._untainted_tag_group.topic)
+ forms.textinput(self._get_topic_valuespec(), "topic", self._untainted_tag_group.topic)
# Choices
forms.section(_("Choices"))
@@ -10284,7 +10284,7 @@ class ModeEditHosttagGroup(ModeEditHosttagConfiguration):
"change its title at the same time! Otherwise WATO will not "
"be able to detect the renaming and cannot exchange the tags "
"in all folders, hosts and rules accordingly."))
- forms.input(self._get_taggroups_valuespec(), "choices", self._untainted_tag_group.get_tags_legacy_format())
+ forms.textinput(self._get_taggroups_valuespec(), "choices", self._untainted_tag_group.get_tags_legacy_format())
# Button and end
forms.end()
diff --git a/tests/unit/cmk/gui/test_table.py b/tests/unit/cmk/gui/test_table.py
index ec78c0a..87c80cc 100644
--- a/tests/unit/cmk/gui/test_table.py
+++ b/tests/unit/cmk/gui/test_table.py
@@ -85,7 +85,7 @@ def test_context(register_builtin_html):
rows = [ (i, i**3) for i in range(10) ]
header = ["Number", "Cubical"]
- with table.open(table_id=table_id, searchable=False, sortable=False):
+ with table.open_table(table_id=table_id, searchable=False, sortable=False):
for row in rows:
table.row()
for i in range(len(header)):
@@ -134,11 +134,11 @@ def test_nesting_context(register_builtin_html):
id = 0
title = " TEST "
- with table.open(table_id=id, title=title, searchable=False, sortable=False):
+ with table.open_table(table_id=id, title=title, searchable=False, sortable=False):
table.row()
table.cell("A", "1")
table.cell("B", "")
- with table.open(id+1, title+"2", searchable=False, sortable=False):
+ with table.open_table(id+1, title+"2", searchable=False, sortable=False):
table.row()
table.cell("_", "+")
table.cell("|", "-")
Module: check_mk
Branch: master
Commit: cc9c900683cc3e6e75e2cfdcbb2b427fb6c377f0
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cc9c900683cc3e…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Sep 28 20:08:15 2018 +0200
unused-import - k.o
Change-Id: If94d3c5683c71ea188b5b1f8c4e52fbdb51f55c6
---
.pylintrc | 4 ----
1 file changed, 4 deletions(-)
diff --git a/.pylintrc b/.pylintrc
index 74d62b0..7c007bb 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -42,10 +42,6 @@ disable=
# depending on an implicit protocol to create them is an even worse one.
global-variable-undefined,
#---------------------------------------------------------------------------
- # We have tons of unused imports, it is just a matter of removing them and
- # leave those which have a "magic" purpose.
- unused-import,
- #---------------------------------------------------------------------------
# Enabling these warnings would be nice, they are mostly a sign of sloppy
# programming practice. In some cases, they can even hide bugs.
bare-except,