From 38fe87c113811faa1d1e8dcb123255314e188c8c Mon Sep 17 00:00:00 2001 From: Timur Sufiev Date: Tue, 10 Sep 2013 17:04:18 +0400 Subject: [PATCH] Show all form-level validation errors, not only one. Change-Id: Iea1ce98fc20f6b5a4639a407e6e557b57d646755 Fixes: MRN-881. --- muranodashboard/panel/services/forms.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/muranodashboard/panel/services/forms.py b/muranodashboard/panel/services/forms.py index 58ca410c7..a018812b1 100644 --- a/muranodashboard/panel/services/forms.py +++ b/muranodashboard/panel/services/forms.py @@ -244,11 +244,13 @@ class ServiceConfigurationForm(UpdatableFieldsForm): cleaned_data = super(ServiceConfigurationForm, self).clean() all_data = self.service.update_cleaned_data(self, cleaned_data) context = yaql.create_context() + error_messages = [] for validator in self.validators: expr = self.get_yaql_expr(validator['expr']) if not yaql.parse(expr).evaluate(all_data, context): - raise forms.ValidationError( - _(validator.get('message', ''))) + error_messages.append(_(validator.get('message', ''))) + if error_messages: + raise forms.ValidationError(error_messages) for name, field in self.fields.iteritems(): if isinstance(field, fields.PasswordField):