Changeset 5100 for main/waeup.sirp/trunk/src/waeup/sirp/accesscodes
- Timestamp:
- 31 Mar 2010, 11:04:27 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/catalog.txt
r5097 r5100 75 75 similar when an access code gets invalidated. 76 76 77 Tools 78 ===== 79 80 :func:`search_invalidated` 81 -------------------------- 82 83 .. function:: search_invalidated(batch_prefix, batch_num) 84 85 Get set of accesscode catalog entries, where the accesscode was 86 already invalidated and that belong to the batch given by the 87 arguments. 88 89 Note, that the set returned for efficiency reasons returns a set of 90 catalog entries (int id mappings) and not the access-code objects 91 themselves. 92 93 :func:`invalidated_num` 94 ----------------------- 95 96 .. function:: invalidated_num(batch_prefix, batch_num) 97 98 Get number of accesscodes found by `search_invalidated` for the 99 batch specified by arguments. 100 77 101 Examples 78 102 ======== … … 105 129 <...AccessCode object at 0x...>, 106 130 <...AccessCode object at 0x...] 131 132 We can lookup catalog entries refering to invalidated accesscodes: 133 134 >>> from waeup.sirp.accesscodes.catalog import search_invalidated 135 >>> r2 = search_invalidated(batch.prefix, batch.num) 136 >>> list(r2) 137 [] 138 139 And also lookup the number of entries: 140 141 >>> from waeup.sirp.accesscodes.catalog import invalidated_num 142 >>> invalidated_num(batch.prefix, batch.num) 143 0 144 145 When we invalidate an accesscode, we will get different results: 146 147 >>> import grok 148 >>> ac0 = list(r1)[0] 149 >>> ac0.invalidation_date = datetime.now() 150 151 We have to fire an ObjectModifiedEvent in order to inform the 152 component architechture about the changed status of the object: 153 154 >>> grok.notify(grok.ObjectModifiedEvent(ac0)) 155 156 >>> invalidated_num(batch.prefix, batch.num) 157 1
Note: See TracChangeset for help on using the changeset viewer.