Changeset 6449
- Timestamp:
- 21 Jun 2011, 15:23:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py
r6439 r6449 256 256 yield filename 257 257 258 # This is temporary reimport solution. Access codes will be imported 259 # with status initialized no matter if they have been used before. 258 260 def reimport(self, filename, creator=u'UNKNOWN'): 259 261 """Reimport a batch given in CSV file. … … 265 267 reader = csv.DictReader(open(path, 'rb'), quoting=csv.QUOTE_ALL) 266 268 entry = reader.next() 267 cost = float(entry[' cost'])269 cost = float(entry['serial']) 268 270 num = int(entry['ac']) 269 batch_name = '%s-%s' % (entry['serial'], num) 271 prefix = entry['prefix'] 272 batch_name = '%s-%s' % (prefix, num) 270 273 if batch_name in self.keys(): 271 274 raise KeyError('Batch already exists: %s' % batch_name) 272 #batch = AccessCodeBatch(273 # datetime.now(), creator, entry['serial'], cost, 0, num=num)274 275 batch = AccessCodeBatch( 275 datetime.now(), creator, entry['serial'], cost, 0, num=0)276 datetime.now(), creator, prefix, cost, 0, num=num) 276 277 num_entries = 0 277 278 self[batch_name] = batch
Note: See TracChangeset for help on using the changeset viewer.