- Timestamp:
- Dec 24, 2012, 2:30:45 AM (13 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 0290330
- Parents:
- 6559695
- git-author:
- Alex Dehnert <adehnert@…> (12/24/12 02:30:45)
- git-committer:
- Alex Dehnert <adehnert@…> (12/24/12 02:30:45)
- File:
-
- 1 edited
-
asadb/groups/load_people.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
asadb/groups/load_people.py
r2538f75 r161ce5f 62 62 # great, they're still in the dump 63 63 changed = False 64 changes = [] 64 65 dcm_person = dcm_people[django_person.username] 65 66 del dcm_people[django_person.username] 67 68 # Check for changes: first fields, then deletions 66 69 for key in fields: 67 70 if django_person.__dict__[key] != dcm_person[key]: 68 71 changed = True 72 if key == 'mit_id': 73 changes.append((key, '[redacted]', '[redacted]', )) 74 else: 75 changes.append((key, django_person.__dict__[key], dcm_person[key])) 69 76 if mutable: 70 77 django_person.__dict__[key] = dcm_person[key] … … 74 81 django_person.del_date = None 75 82 stat_undel += 1 76 stat_people['undel'].append(django_person.username) 83 changes.append(('[account]', '[deleted]', '[undeleted]', )) 84 stat_people['undel'].append((django_person.username, changes)) 85 77 86 if changed: 87 stat_name = '' 78 88 if mutable: 79 89 django_person.mod_date = datetime.date.today() 80 90 django_person.save() 81 91 stat_changed += 1 82 stat_ people['changed'].append(django_person.username)92 stat_name = 'changed' 83 93 else: 84 94 stat_mut_ign += 1 85 stat_people['mut_ign'].append(django_person.username) 95 stat_name = 'mut_ign' 96 stat_people[stat_name].append((django_person.username, changes)) 86 97 else: 87 98 stat_unchanged += 1 99 88 100 else: 101 # They're not in the dump 89 102 if django_person.del_date is None: 103 stat_name = '' 90 104 if mutable: 91 105 django_person.del_date = datetime.date.today() 92 106 stat_del += 1 93 stat_ people['del'].append(django_person.username)107 stat_name = 'del' 94 108 django_person.save() 95 109 else: 96 110 stat_mut_ign += 1 97 stat_people['mut_ign'].append(django_person.username) 111 stat_name = 'mut_ign' 112 changes = [('account_class', django_person.account_class, '[deleted]')] 113 stat_people[stat_name].append((django_person.username, changes)) 98 114 else: 99 115 stat_pre_del += 1 116 117 transaction.commit() 118 119 # Import new people from the DCM 100 120 for username, dcm_person in dcm_people.items(): 101 121 stat_loops += 1 … … 108 128 django_person.add_date = datetime.date.today() 109 129 stat_add += 1 110 stat_people['add'].append(django_person.username) 130 changes = [('account_class', '[missing]', dcm_person['account_class'], )] 131 stat_people['add'].append((django_person.username, changes)) 111 132 django_person.save() 112 133 transaction.commit() 134 113 135 stats = { 114 136 'loops': stat_loops, … … 147 169 148 170 for change_type, people in stat_people.items(): 149 for person in people:150 print "%12s\t% s" % (change_type, person, )171 for person, changes in people: 172 print "%12s\t%12s\t%s" % (change_type, person, changes, ) 151 173 print ""
Note: See TracChangeset
for help on using the changeset viewer.