Module: check_mk
Branch: master
Commit: ec51d24dc52e367cd95c3b90fca47d90f9976488
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ec51d24dc52e36…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Oct 27 19:43:43 2011 +0200
FIX: crash when sorting with join without title
---
ChangeLog | 2 ++
web/htdocs/views.py | 20 ++++++++++++--------
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2e30def..d263ee1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -35,6 +35,8 @@
Multisite:
* FIX: finally fixed long-wanted "NagStaMon create hundreds
of Apache processes" problem!
+ * FIX: query crashed when sorting after a join columns without
+ an explicit title.
1.1.12:
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index f4a50be..ebae2c3 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -1205,6 +1205,7 @@ def show_view(view, show_heading = False, show_buttons = True,
show_footer = Tru
else:
join_columns += s[0]["columns"]
+
# Add key columns, needed for executing commands
columns += datasource["keys"]
@@ -1218,7 +1219,7 @@ def show_view(view, show_heading = False, show_buttons = True,
show_footer = Tru
columns = list(colset)
# Get list of painter options we need to display (such as PNP time range
- # or the format being used for timestamp display
+ # or the format being used for timestamp display)
painter_options = []
for entry in all_painters:
p = entry[0]
@@ -2448,16 +2449,19 @@ def sort_url(view, painter, join_index):
return ','.join(p)
def paint_header(view, p):
+ # The variable p is a tuple with the following components:
+ # p[0] --> painter object, from multisite_painters[]
+ # p[1] --> view name to link to or None (not needed here)
+ # p[2] --> tooltip (title) to display (not needed here)
+ # p[3] --> optional: join key (e.g. service description)
+ # p[4] --> optional: column title to use instead default
painter = p[0]
join_index = None
+ t = painter.get("short", painter["title"])
if len(p) >= 4: # join column
- if len(p) >= 5 and p[4]:
- t = p[4]
- join_index = p[3]
- else:
- t = p[3]
- else:
- t = painter.get("short", painter["title"])
+ join_index = p[3]
+ if len(p) >= 5 and p[4]:
+ t = p[4]
# Optional: Sort link in title cell
# Use explicit defined sorter or implicit the sorter with the painter name