When a plugin makes a request and backend fails in some Wok routine or
function, a Wok error message is returned. However, only the message
code is displayed not the message text.
This patch fixes this problem, so Wok error messages are displayed
properly.
Signed-off-by: Rodrigo Trujillo <rodrigo.trujillo(a)linux.vnet.ibm.com>
---
src/wok/exception.py | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/wok/exception.py b/src/wok/exception.py
index 878922a..023334b 100644
--- a/src/wok/exception.py
+++ b/src/wok/exception.py
@@ -43,10 +43,11 @@ class WokException(Exception):
# itself to a unicode string.
args[key] = unicode(value)
- if cherrypy.request.app:
+ # First, check if it is a Wok error message, then search in plugin
+ # error messages list
+ msg = _messages.get(code, code)
+ if (msg == code) and (cherrypy.request.app):
msg = self._get_translation()
- else:
- msg = _messages.get(code, code)
msg = unicode(msg, 'utf-8') % args
pattern = "%s: %s" % (code, msg)
--
2.1.0