Changeset 94f3a39
- Timestamp:
- Mar 28, 2012, 6:16:55 AM (14 years ago)
- Branches:
- master, space-access, stable, stage
- Children:
- 5680065
- Parents:
- 96ef09f
- git-author:
- Alex Dehnert <adehnert@…> (03/28/12 06:14:59)
- git-committer:
- Alex Dehnert <adehnert@…> (03/28/12 06:16:55)
- Location:
- asadb/space
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
asadb/space/diffs.py
r57a2ad6 r94f3a39 144 144 new_data = the_space.build_access(time=new_time) 145 145 all_spaces[the_space.pk] = the_space 146 init_groups(group_data, old_data[ 1])147 init_groups(group_data, new_data[ 1])146 init_groups(group_data, old_data[2]) 147 init_groups(group_data, new_data[2]) 148 148 for group_pk, group in group_data.items(): 149 149 if group_pk in old_data[0] or group_pk in new_data[0]: -
asadb/space/models.py
r9dfb3d5 r94f3a39 42 42 Usually, the sets will each have one member, but ID 999999999 is decently likely to have several. 43 43 The SpaceAccessListEntrys will be filtered to reflect assignments as of that time. 44 access_by_id: 45 ID -> (Name -> (Set Group.pk)) 46 Indicates who has access. Grouped by ID number and name. 47 Usually, each ID dict will have one member, but ID 999999999 is, again, likely to have several. 48 This is intended for rooms that have one access list (e.g., W20-437 and W20-441) 44 49 assignments: 45 50 [SpaceAssignment] … … 65 70 aces = aces.filter(group=group) 66 71 access = {} # Group.pk -> (ID -> Set name) 72 access_by_id = {} # ID -> (Name -> (Set Group.pk)) 67 73 for assignment in assignments: 68 74 if assignment.group.pk not in access: … … 71 77 if ace.group.pk in access: 72 78 access[ace.group.pk][ace.card_number].add(ace.name) 79 if ace.card_number not in access_by_id: 80 access_by_id[ace.card_number] = collections.defaultdict(set) 81 access_by_id[ace.card_number][ace.name].add(ace.group.pk) 73 82 else: 74 83 # This group appears to no longer have access... 75 84 errors.append("Group %s no longer has access to %s, but has live ACEs." % (ace.group, self, )) 76 return access, a ssignments, aces, errors85 return access, access_by_id, assignments, aces, errors 77 86 78 87 reversion.register(Space)
Note: See TracChangeset
for help on using the changeset viewer.