[checkmk-commits] Check_MK Git: check_mk: Fixed missing fix in last commit

Lars Michelsen lm at mathias-kettner.de
Thu Feb 5 16:18:19 CET 2015


Module: check_mk
Branch: master
Commit: 785799f933e0b833be449e04eee7f6a604a9a7e7
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=785799f933e0b833be449e04eee7f6a604a9a7e7

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Thu Feb  5 16:18:14 2015 +0100

Fixed missing fix in last commit

---

 web/htdocs/views.py             |   13 +++++++------
 web/plugins/views/webservice.py |    9 ++++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 76c7eff..cb93aee 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -2026,18 +2026,19 @@ def paint_painter(painter, row):
     else:
         return painter["paint"](row)
 
-def get_join_key(p):
-    return len(p) >= 4 and p[3] or None
+def join_row(row, p):
+    join_key = len(p) >= 4 and p[3] or None
+    if join_key != None:
+        return row.get("JOIN", {}).get(join_key)
+    else:
+        return row
 
 def prepare_paint(p, row):
     painter = p[0]
     linkview = p[1]
     tooltip = len(p) > 2 and p[2] or None
 
-    join_key = get_join_key(p)
-    if join_key != None:
-        row = row.get("JOIN", {}).get(join_key)
-
+    row = join_row(row, p)
     tdclass, content = paint_painter(painter, row)
     if tdclass == "" and content == "":
         return tdclass, content
diff --git a/web/plugins/views/webservice.py b/web/plugins/views/webservice.py
index f7e49a7..6ca0251 100644
--- a/web/plugins/views/webservice.py
+++ b/web/plugins/views/webservice.py
@@ -41,7 +41,8 @@ def render_python(rows, view, group_painters, painters, num_columns, show_checkb
     for row in rows:
         html.write("[")
         for p in painters:
-            tdclass, content = paint_painter(p[0], row, join_key=get_join_key(p))
+            row = join_row(row, p)
+            tdclass, content = paint_painter(p[0], row)
             html.write(repr(html.strip_tags(content)))
             html.write(",")
         html.write("],")
@@ -94,7 +95,8 @@ def render_json(rows, view, group_painters, painters, num_columns, show_checkbox
                 first = False
             else:
                 html.write(",")
-            tdclass, content = paint_painter(p[0], row, join_key=get_join_key(p))
+            row = join_row(row, p)
+            tdclass, content = paint_painter(p[0], row)
             if type(content) == unicode:
 	        content = content.encode("utf-8")
             else:
@@ -161,7 +163,8 @@ def render_csv(rows, view, group_painters, painters, num_columns, show_checkboxe
                 first = False
             else:
                 html.write(csv_separator)
-            tdclass, content = paint_painter(p[0], row, join_key=get_join_key(p))
+            row = join_row(row, p)
+            tdclass, content = paint_painter(p[0], row)
             content = type(content) in [ int, float ] and str(content) or content
             stripped = html.strip_tags(content).replace('\n', '').replace('"', '""')
             html.write('"%s"' % stripped.encode("utf-8"))



More information about the checkmk-commits mailing list