X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=portal%2Fslicerequestview.py;h=0a8f99899730d874e96adabccaf4a09260e4f97f;hb=91744872798085327e2145b2704781996723c64b;hp=f9c4636dc1c6aca610b19518658b654d5791b833;hpb=c8396ad1b6cf17a60769496c3b51aa1e390575cc;p=unfold.git diff --git a/portal/slicerequestview.py b/portal/slicerequestview.py index f9c4636d..0a8f9989 100644 --- a/portal/slicerequestview.py +++ b/portal/slicerequestview.py @@ -17,6 +17,7 @@ from myslice.theme import ThemeView import json, time, re import activity.user +theme = ThemeView() class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView): template_name = 'slicerequest_view.html' @@ -92,7 +93,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView): # Page rendering page = Page(wsgi_request) page.add_js_files ( [ "js/jquery.validate.js", "js/jquery-ui.js" ] ) - page.add_css_files ( [ "https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" ] ) + page.add_css_files ( [ "css/jquery-ui.css" ] ) page.expose_js_metadata() if method == 'POST': @@ -113,7 +114,7 @@ class SliceRequestView (LoginRequiredAutoLogoutView, ThemeView): # Handle project if used project = wsgi_request.POST.get('project', None) - if project is not None: + if project is not None and project != '': authority_hrn = project slice_request = { @@ -148,9 +149,17 @@ 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') + organization = slice_request['organization'] + if theme.theme == 'fed4fire': + if (organization is None or organization == ''): + errors.append('Selecting project is mandatory') + else: + if (organization is None or organization == ''): + errors.append('Organization is mandatory') + + slice_length= len(slice_request['slice_name']) + if slice_length >19: + errors.append('Slice name can be maximum 19 characters long')