From: gfawcett Date: Mon, 10 Jan 2011 04:13:30 +0000 (+0000) Subject: add extra instructors to site. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=53fdcf928264684e400fa181787651397171bc05;p=Syrup.git add extra instructors to site. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1180 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/uwindsor_migration/physicals-extract.py b/conifer/uwindsor_migration/physicals-extract.py index aa32fa0..06f6035 100644 --- a/conifer/uwindsor_migration/physicals-extract.py +++ b/conifer/uwindsor_migration/physicals-extract.py @@ -94,6 +94,7 @@ for line in file('list-as-text'): else: # this one we can actually use! print ('OK', code, title, profs, url) + persons = sorted(list(persons), key=lambda p: p.sn) sections = [] for prof in persons: for sec in prof.uwinCourseTeach: @@ -104,6 +105,10 @@ for line in file('list-as-text'): # set up the access control lists for uid, sec in sections: Group.objects.get_or_create(site=site, external_id=sec) + group = site.group_set.get(external_id__isnull=True) + for uid in [p.uid for p in persons][1:]: + Membership.objects.get_or_create(group=group, user=ensure_user(uid), + role='INSTR') # let's lookup the items. site.item_set.filter(item_type='PHYS').delete() @@ -115,3 +120,4 @@ for line in file('list-as-text'): count+=1 # if count > 5: # break +