From: Loic Baron Date: Mon, 9 Mar 2015 18:53:49 +0000 (+0100) Subject: Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab X-Git-Tag: myslice-1.3~58^2^2~3 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=111d0fcb9681bf94ff184fe43bf636b6d672cbff;hp=-c;p=unfold.git Merge branch 'onelab' of ssh://git.onelab.eu/git/myslice into onelab Conflicts: portal/joinview.py portal/registrationview.py --- 111d0fcb9681bf94ff184fe43bf636b6d672cbff diff --combined myslice/settings.py index 5c75970b,10b39533..f9f439e1 --- a/myslice/settings.py +++ b/myslice/settings.py @@@ -1,5 -1,7 +1,7 @@@ # Django settings for unfold project. + from __future__ import print_function + import os.path import djcelery @@@ -13,7 -15,9 +15,9 @@@ except building=True DEBUG = True - TEMPLATE_DEBUG = DEBUG + + # show the various settings as we go + DEBUG_SETTINGS = False # compute ROOT from where this file is installed # should fit every need including developers @@@ -45,9 -49,13 +49,13 @@@ except # when deployed from a package # this code is run by collectstatic too, so we cannot # assume we have ./static present already -HTTPROOT="/var/myslice-f4f" +HTTPROOT="/var/www/myslice/" # the place to store local data, like e.g. the sqlite db DATAROOT="/var/unfold" + if not os.path.isdir(DATAROOT): + print("WARNING: {} is a non-existing directory".format(DATAROOT)) + print("consequently we assume development mode and re-route DATAROOT to {}".format(ROOT)) + DATAROOT=ROOT # if not there, then we assume it's from a devel tree if not os.path.isdir (os.path.join(HTTPROOT,"static")): HTTPROOT=ROOT @@@ -55,6 -63,11 +63,11 @@@ if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for unfold"%ROOT if not os.path.isdir(HTTPROOT): raise Exception,"Cannot find HTTPROOT %s for unfold"%HTTPROOT + if DEBUG_SETTINGS: + print('ROOT', ROOT) + print('DATAROOT', DATAROOT) + print('HTTPROOT', HTTPROOT) + # dec 2013 - we currently have 2 auxiliary subdirs with various utilities # that we do not wish to package # * sandbox is for plugin developers @@@ -101,6 -114,9 +114,9 @@@ DATABASES = } } + if DEBUG_SETTINGS: + print('DATABASE NAME',DATABASES['default']['NAME']) + # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # although not all choices may be available on all operating systems. @@@ -252,7 -268,7 +268,7 @@@ BROKER_URL = "amqp://myslice:myslice@lo for aux in auxiliaries: if os.path.isdir(os.path.join(ROOT,aux)): - print "Using devel auxiliary",aux + print("Using devel auxiliary",aux) INSTALLED_APPS.append(aux) ACCOUNT_ACTIVATION_DAYS = 7 # One-week activation window; you may, of course, use a different value. diff --combined portal/registrationview.py index 8749f537,d1c12ca5..c54bcab2 --- a/portal/registrationview.py +++ b/portal/registrationview.py @@@ -45,6 -45,7 +45,7 @@@ class RegistrationView (FreeAccessView authorities_query = Query.get('authority').select('name', 'authority_hrn') authorities = execute_admin_query(wsgi_request, authorities_query) if authorities is not None: + authorities = sorted(authorities, key=lambda k: k['authority_hrn']) authorities = sorted(authorities, key=lambda k: k['name']) print "############ BREAKPOINT 1 #################" @@@ -80,7 -81,7 +81,7 @@@ 'current_site' : current_site, 'email_hash' : email_hash, 'pi' : '', - 'validation_link': current_site + '/portal/email_activation/'+ email_hash + 'validation_link': 'https://' + current_site + '/portal/email_activation/'+ email_hash } print "############ BREAKPOINT 4 #################" @@@ -138,7 -139,7 +139,7 @@@ # sqlite3 /var/unfold/unfold.sqlite3 # select email from auth_user; if UserModel._default_manager.filter(email__iexact = user_request['email']): - errors.append('Contact OneLab support or try with another email.') + errors.append('Contact support or try with another email.') # XXX TODO: Factorize with portal/accountview.py # XXX TODO: Factorize with portal/registrationview.py diff --combined portal/slicetabexperiment.py index ca942315,9260f27a..324ee0a9 --- a/portal/slicetabexperiment.py +++ b/portal/slicetabexperiment.py @@@ -17,6 -17,8 +17,8 @@@ from myslice.configengine import Config from myslice.theme import ThemeView from myslice.configengine import ConfigEngine + from sfa.planetlab.plxrn import hash_loginbase + import urllib2,json class ExperimentView (FreeAccessView, ThemeView): @@@ -26,12 -28,14 +28,14 @@@ username = self.request.user - split_slicename = slicename.split('.') - ple_slicename = split_slicename[0] + '8' + split_slicename[1] + '_' + split_slicename[2] - - query_current_resources = Query.get('slice').select('resource').filter_by('slice_hrn','==',slicename) + query_current_resources = Query.get('slice').select('resource','parent_authority').filter_by('slice_hrn','==',slicename) current_resources = execute_query(request, query_current_resources) + parent_authority = current_resources[0]['parent_authority'] + + split_slicename = slicename.split('.') + ple_slicename = hash_loginbase(parent_authority) + '_' + split_slicename[-1] + ple_resource_list=[] nitos_resource_list=[] nitos_paris_resource_list=[] @@@ -74,7 -78,6 +78,7 @@@ #print "list of nitos res hrns" #print nitos_resource_list + all_users = list() #get all iotlab users try: engine = ConfigEngine() @@@ -89,6 -92,7 +93,6 @@@ except urllib2.URLError as e: print "There is a problem in getting iotlab users %s" % e.reason - all_users = list() #getting the login from email #initial value no-account == contact_admin