Changeset 5127
- Timestamp:
- 5 Apr 2010, 13:44:44 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py
r5123 r5127 95 95 for x in range(10): 96 96 pin += str(random().randint(0, 9)) 97 if '%s-%s-%s' % (self.prefix, self.num, pin) in self._acids: 98 # PIN already in use 99 continue 100 curr += 1 101 yield pin 97 if not '%s-%s-%s' % (self.prefix, self.num, pin) in self._acids: 98 curr += 1 99 yield pin 100 # PIN already in use 102 101 103 102 def _getStoragePath(self): … … 207 206 self._p_changed = True 208 207 208 def createBatch(self, creation_date, creator, batch_prefix, cost, 209 entry_num): 210 """Create and add a batch. 211 """ 212 batch_num = self.getNum(batch_prefix) 213 batch = AccessCodeBatch(creation_date, creator, batch_prefix, 214 cost, entry_num, num=batch_num) 215 self.addBatch(batch) 216 return batch 217 209 218 def getNum(self, prefix): 210 219 """Get next unused num for given prefix.
Note: See TracChangeset for help on using the changeset viewer.