diff --git a/gnowsys-ndf/fabfile.py b/gnowsys-ndf/fabfile.py index 1bfeaffc35..3afca61925 100644 --- a/gnowsys-ndf/fabfile.py +++ b/gnowsys-ndf/fabfile.py @@ -52,21 +52,21 @@ def purge_group(): local('python manage.py purge_group') -def setup_dlkit(): - import os - dirspot = os.getcwd() - if "/home/docker/code/gstudio/gnowsys-ndf" == dirspot: - if not os.path.isdir('./dlkit') and not os.path.isdir('./dlkit_runtime'): - local('git checkout dlkit') - local('git pull origin dlkit') - local('git clone https://bitbucket.org/cjshaw/dlkit_runtime.git') - local('git clone https://bitbucket.org/cjshaw/dlkit-tests.git') - local('git clone https://bitbucket.org/cjshaw/dlkit.git') - os.chdir('/home/docker/code/gstudio/gnowsys-ndf/dlkit') - local('git submodule update --init --recursive') - os.chdir('/home/docker/code/gstudio/gnowsys-ndf/') - else: - print "dlkit and dlkit_runtime are already exists." - else: - os.chdir('/home/docker/code/gstudio/gnowsys-ndf') - setup_dlkit() +# def setup_dlkit(): +# import os +# dirspot = os.getcwd() +# if "/home/docker/code/gstudio/gnowsys-ndf" == dirspot: +# if not os.path.isdir('./dlkit') and not os.path.isdir('./dlkit_runtime'): +# local('git checkout dlkit') +# local('git pull origin dlkit') +# local('git clone https://bitbucket.org/cjshaw/dlkit_runtime.git') +# local('git clone https://bitbucket.org/cjshaw/dlkit-tests.git') +# local('git clone https://bitbucket.org/cjshaw/dlkit.git') +# os.chdir('/home/docker/code/gstudio/gnowsys-ndf/dlkit') +# local('git submodule update --init --recursive') +# os.chdir('/home/docker/code/gstudio/gnowsys-ndf/') +# else: +# print "dlkit and dlkit_runtime are already exists." +# else: +# os.chdir('/home/docker/code/gstudio/gnowsys-ndf') +# setup_dlkit() diff --git a/gnowsys-ndf/gnowsys_ndf/ndf/management/commands/sync_users.py b/gnowsys-ndf/gnowsys_ndf/ndf/management/commands/sync_users.py index fa205973b8..dc897badcf 100644 --- a/gnowsys-ndf/gnowsys_ndf/ndf/management/commands/sync_users.py +++ b/gnowsys-ndf/gnowsys_ndf/ndf/management/commands/sync_users.py @@ -40,6 +40,8 @@ def handle(self, *args, **options): if not file_input or not os.path.exists(file_input): file_input = raw_input("\nEnter below file path to be used:\n") + techer_element_set = {'carbon', 'chlorine', 'copper', 'helium', 'iron', 'nitrogen', 'oxygen', 'silver', 'sodium', 'zinc'} + if os.path.exists(file_input): msg = '\nFound file: "' + str(file_input) + '"\n\n' @@ -82,7 +84,11 @@ def handle(self, *args, **options): auth['modified_by'] = user_id auth['contributors'] = [user_id] auth['group_admin'] = [user_id] - auth['agency_type'] = "Student" + auth['agency_type'] = 'Student' + try: + auth['agency_type'] = 'Teacher' if (username.split('-')[1] in techer_element_set) else 'Student' + except Exception, e: + auth['agency_type'] = 'Student' oid = ObjectId(oid) auth['_id'] = oid auth.save(groupid=oid)