use logger instead of print as often as possible
[unfold.git] / portal / projectrequestview.py
index aaa79b2..a505f14 100644 (file)
@@ -1,3 +1,7 @@
+import json
+import time
+import re
+
 from django.shortcuts           import render
 from django.contrib.sites.models import Site
 
@@ -10,8 +14,7 @@ from portal.actions import create_pending_project, create_pending_join, sfa_add_
 from portal.models import PendingProject, PendingJoin
 
 from myslice.theme import ThemeView
-
-import json, time, re
+from myslice.settings import logger
 
 class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
     template_name = 'projectrequest_view.html'
@@ -109,7 +112,7 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
                     errors.append('Organization is mandatory')
     
                 if (post['purpose'] is None or post['purpose'] == ''):
-                    errors.append('Experiment purpose is mandatory')
+                    errors.append('Project purpose is mandatory')
 
                 if (re.search(r'^[A-Za-z0-9_]*$', post['project_name']) == None):
                     errors.append('Project name may contain only letters, numbers, and underscore.')
@@ -119,7 +122,7 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
                 errors.append('Project name is mandatory')
             
             if not errors:
-                print "is_pi on auth_hrn = ", user_authority
+                logger.info("is_pi on auth_hrn = {}".format(user_authority))
                 if is_pi(wsgi_request, user_hrn, user_authority):
                     # PIs can directly create/join project in their own authority...
                     if 'join' in wsgi_request.POST:
@@ -128,14 +131,14 @@ class ProjectRequestView(LoginRequiredAutoLogoutView, ThemeView):
                         hrn = post['authority_hrn'] + '.' + post['project_name']
                         sfa_add_authority(wsgi_request, {'authority_hrn':hrn})
                         authority_add_pis(wsgi_request, hrn, user_hrn)
-                    self.template_name = 'slice-request-done-view.html'
+                    self.template_name = 'project-request-done-view.html'
                 else:
                     # Otherwise a wsgi_request is sent to the PI
                     if 'join' in wsgi_request.POST:
                         create_pending_join(wsgi_request, post)
                     else:
                         create_pending_project(wsgi_request, post)
-                    self.template_name = 'slice-request-ack-view.html'
+                    self.template_name = 'project-request-ack-view.html'
 
         # retrieves the pending projects creation list
         pending_projects = PendingProject.objects.all().filter(user_hrn=user_hrn)