Module: check_mk
Branch: master
Commit: 01d69f69cb482c64b56c6678ed28a23592f948b4
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=01d69f69cb482c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Apr 14 17:04:57 2015 +0200
#2178 FIX Fixed handling of user erros in WATO when using Python < 2.5
---
.werks/2178 | 10 ++++++++++
ChangeLog | 1 +
web/htdocs/lib.py | 5 ++++-
web/htdocs/wato.py | 4 ++--
4 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/.werks/2178 b/.werks/2178
new file mode 100644
index 0000000..a09b2de
--- /dev/null
+++ b/.werks/2178
@@ -0,0 +1,10 @@
+Title: Fixed handling of user erros in WATO when using Python < 2.5
+Level: 1
+Component: wato
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1429023858
+
+
diff --git a/ChangeLog b/ChangeLog
index 6fe6419..f749720 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -440,6 +440,7 @@
* 2160 FIX: Fixed rename of hosts where a host with this name did exist before
* 2191 FIX: Fixed handling of URL variable 'mode' in web API for discovering
services...
* 1956 FIX: WATO Web-API: Fixed exception information for single sites...
+ * 2178 FIX: Fixed handling of user erros in WATO when using Python < 2.5
Notifications:
* 1662 notification plugin spectrum: finalized script. now able to handle host
notications
diff --git a/web/htdocs/lib.py b/web/htdocs/lib.py
index 9d11009..73e9ac7 100644
--- a/web/htdocs/lib.py
+++ b/web/htdocs/lib.py
@@ -51,8 +51,11 @@ LOG_DEBUG = 7 # debug-level messages
class MKException(Exception):
# Do not use the Exception() __str__, because it uses str()
# to convert the message. We want to keep unicode strings untouched
+ # And don't use self.message, because older python versions don't
+ # have this variable set. self.args[0] seems to be the most portable
+ # way at the moment.
def __str__(self):
- return self.message
+ return self.args[0]
class MKGeneralException(MKException):
plain_title = _("General error")
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index ad2f0e3..03c6f45 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -271,8 +271,8 @@ def page_handler():
config.need_permission(pname)
except MKUserError, e:
- action_message = e.message
- html.add_user_error(e.varname, e.message)
+ action_message = str(e)
+ html.add_user_error(e.varname, str(e))
except MKAuthException, e:
action_message = e.reason