add extra instructors to site.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 10 Jan 2011 04:13:30 +0000 (04:13 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Mon, 10 Jan 2011 04:13:30 +0000 (04:13 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1180 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/uwindsor_migration/physicals-extract.py

index aa32fa0..06f6035 100644 (file)
@@ -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
+