summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhurong <aaronzhu1121@gmail.com>2017-11-29 10:16:33 +0800
committerzhurong <aaronzhu1121@gmail.com>2017-11-29 10:18:40 +0800
commitbb4f3ffc4b07fd1dc07a09360665d8dc93925f3e (patch)
tree145d5ba002e761d8bdd7e87deb7af15e427e0294
parent5cbd08e64a58a63cb63330a999cc44b4538e292f (diff)
Make create env show the correct error message
Now create env with null name or space only show: "This field is required" error message, didn't show the correct message: "Environment name must contain at least one non-white space symbol." This will also fix the dashboard functional test cases about create env. Change-Id: I4f2be3320eeb02e0d0953eee8426cc5aae685865 Closes-Bug: #1735035
Notes
Notes (review): Code-Review+2: Felipe Monteiro <felipe.monteiro@att.com> Workflow+1: Felipe Monteiro <felipe.monteiro@att.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Fri, 01 Dec 2017 02:22:54 +0000 Reviewed-on: https://review.openstack.org/523657 Project: openstack/murano-dashboard Branch: refs/heads/master
-rw-r--r--muranodashboard/environments/forms.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/muranodashboard/environments/forms.py b/muranodashboard/environments/forms.py
index d6bf71d..0f50843 100644
--- a/muranodashboard/environments/forms.py
+++ b/muranodashboard/environments/forms.py
@@ -67,12 +67,12 @@ class CreateEnvironmentForm(horizon_forms.SelfHandlingForm):
67 self.fields['net_config'].choices = net_choices 67 self.fields['net_config'].choices = net_choices
68 self.fields['net_config'].help_text = help_text 68 self.fields['net_config'].help_text = help_text
69 69
70 def clean_name(self): 70 def clean(self):
71 cleaned_data = super(CreateEnvironmentForm, self).clean() 71 cleaned_data = super(CreateEnvironmentForm, self).clean()
72 env_name = cleaned_data.get('name') 72 env_name = cleaned_data.get('name')
73 if not env_name.strip(): 73 if not env_name or not env_name.strip():
74 self._errors['name'] = self.error_class([ENV_NAME_HELP_TEXT]) 74 self._errors['name'] = self.error_class([ENV_NAME_HELP_TEXT])
75 return env_name 75 return cleaned_data
76 76
77 def handle(self, request, data): 77 def handle(self, request, data):
78 try: 78 try: