Fix: minor bug in slice req
authorYasin <mohammed-yasin.rahman@lip6.fr>
Tue, 15 Jul 2014 16:16:45 +0000 (18:16 +0200)
committerYasin <mohammed-yasin.rahman@lip6.fr>
Tue, 15 Jul 2014 16:16:45 +0000 (18:16 +0200)
portal/slicerequestview.py
portal/templates/onelab/onelab_slicerequest_view.html

index 1bcbc5d..449147c 100644 (file)
@@ -91,7 +91,8 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             current_site = Site.objects.get_current()
             current_site = current_site.domain
             
-            # getting the authority_hrn from the selected organization           
+            # getting the authority_hrn from the selected organization
+            authority_hrn = ''           
             for authority in authorities:
                 if authority['name'] == wsgi_request.POST.get('org_name', ''):
                     authority_hrn = authority['authority_hrn']
@@ -122,10 +123,6 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
                 if _slice['slice_hrn'] == req_slice_hrn:
                     errors.append('Slice already exists. Please use a different slice name.')
             
-            exp_url = slice_request['exp_url']
-           
-            if (authority_hrn is None or authority_hrn == ''):
-                errors.append('Please, select an organization')
 
             # What kind of slice name is valid?
             if (slice_name is None or slice_name == ''):
@@ -133,11 +130,18 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView):
             
             if (re.search(r'^[A-Za-z0-9_]*$', slice_name) == None):
                 errors.append('Slice name may contain only letters, numbers, and underscore.')
+            
+            organization = slice_request['organization']    
+            if (organization is None or organization == ''):
+                errors.append('Organization is mandatory')
+
 
     
             purpose = slice_request['purpose']
             if (purpose is None or purpose == ''):
-                errors.append('Purpose is mandatory')
+                errors.append('Experiment purpose is mandatory')
+
+            exp_url = slice_request['exp_url']
 
             if not errors:
                 if is_pi(wsgi_request, user_hrn, authority_hrn):
index 52c84e0..47068c4 100644 (file)
@@ -47,7 +47,7 @@
                                title="Please provide the url of your experiment if you have one." value="{{exp_url}}">
                          </div>
                          <div class="form-group">
-                               <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment Purpose" style="width:300px" 
+                               <textarea id="purpose" name="purpose" class="form-control" rows="6" placeholder="Experiment purpose" style="width:300px" 
                                title="Purpose of your experiment (informative)" required="required">{{ purpose }}</textarea>
                          </div>
                          <button type="submit" class="btn btn-onelab"><span class="glyphicon glyphicon-plus"></span> Request Slice</button>