Skip to content

Commit

Permalink
Updated 'sync_users.py' script to add 'Teachers' for elements and 'St…
Browse files Browse the repository at this point in the history
…udents' for others in agency_type field of Author instance
  • Loading branch information
kedar2a committed Jun 17, 2017
1 parent 50509ae commit 7b32cc4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
36 changes: 18 additions & 18 deletions gnowsys-ndf/fabfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 7b32cc4

Please sign in to comment.