From 72f440f509b26337749f31d5eb5814dcf541d38d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 17 Oct 2017 11:32:03 +0200 Subject: [PATCH] Fix AttributeError Exceptions aren't guaranteed to have a 'message' attribute. It does have 'args', but str(ex) is probably more useful as it's likely to include the exception type. --- pillar/web/utils/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pillar/web/utils/forms.py b/pillar/web/utils/forms.py index c7dd85b5..c38abcd6 100644 --- a/pillar/web/utils/forms.py +++ b/pillar/web/utils/forms.py @@ -181,7 +181,7 @@ class JSONRequired(validators.DataRequired): try: json.loads(field.data) except ValueError as ex: - message = self.message or ex.message + message = self.message or str(ex) field.errors[:] = [] raise validators.StopValidation(message)