Changeset 7f2776e
- Timestamp:
- Jan 26, 2012, 2:50:28 AM (14 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 84af6d7
- Parents:
- 8cc4d6d
- git-author:
- Alex Dehnert <adehnert@…> (01/26/12 02:49:57)
- git-committer:
- Alex Dehnert <adehnert@…> (01/26/12 02:50:28)
- File:
-
- 1 edited
-
asadb/groups/load_people.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/load_people.py
rd241a05 r7f2776e 14 14 import groups.models 15 15 16 import collections 16 17 import datetime 17 18 … … 51 52 stat_undel = 0 52 53 stat_add = 0 54 stat_people = collections.defaultdict(list) 53 55 for django_person in django_people: 54 56 stat_loops += 1 … … 72 74 django_person.del_date = None 73 75 stat_undel += 1 76 stat_people['undel'].append(django_person.username) 74 77 if changed: 75 78 if mutable: … … 77 80 django_person.save() 78 81 stat_changed += 1 82 stat_people['changed'].append(django_person.username) 79 83 else: 80 84 stat_mut_ign += 1 85 stat_people['mut_ign'].append(django_person.username) 81 86 else: 82 87 stat_unchanged += 1 … … 86 91 django_person.del_date = datetime.date.today() 87 92 stat_del += 1 93 stat_people['del'].append(django_person.username) 88 94 django_person.save() 89 95 else: 90 96 stat_mut_ign += 1 97 stat_people['mut_ign'].append(django_person.username) 91 98 else: 92 99 stat_pre_del += 1 100 stat_people['pre_del'].append(django_person.username) 93 101 for username, dcm_person in dcm_people.items(): 94 102 stat_loops += 1 … … 101 109 django_person.add_date = datetime.date.today() 102 110 stat_add += 1 111 stat_people['add'].append(django_person.username) 103 112 django_person.save() 104 113 transaction.commit() … … 115 124 'add': stat_add, 116 125 } 117 return stats 126 return stats, stat_people 118 127 119 128 … … 123 132 print "Phase 1 (DCM parsing): complete at %s" % (datetime.datetime.now(), ) 124 133 print "Phase 2 (Django updating): starting at %s" % (datetime.datetime.now(), ) 125 stats = load_people(dcm_people)134 stats, stat_people = load_people(dcm_people) 126 135 print "Phase 2 (Django updating): complete at %s" % (datetime.datetime.now(), ) 127 136 print """ … … 136 145 Undeleted: %(undel)6d 137 146 Added: %(add)6d""" % stats 147 148 for change_type, people in stat_people.items(): 149 for person in people: 150 print "%12s\t%s" % (change_type, person, ) 151 print ""
Note: See TracChangeset
for help on using the changeset viewer.