Ignore:
Timestamp:
21 Jun 2011, 15:23:57 (14 years ago)
Author:
Henrik Bettermann
Message:

Fix reimport of Ac batches. This is temporary reimport solution. Access codes will be imported with status initialized no matter if they have been used before.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/accesscodes/accesscodes.py

    r6439 r6449  
    256256            yield filename
    257257
     258    # This is temporary reimport solution. Access codes will be imported
     259    # with status initialized no matter if they have been used before.
    258260    def reimport(self, filename, creator=u'UNKNOWN'):
    259261        """Reimport a batch given in CSV file.
     
    265267        reader = csv.DictReader(open(path, 'rb'), quoting=csv.QUOTE_ALL)
    266268        entry = reader.next()
    267         cost = float(entry['cost'])
     269        cost = float(entry['serial'])
    268270        num = int(entry['ac'])
    269         batch_name = '%s-%s' % (entry['serial'], num)
     271        prefix = entry['prefix']
     272        batch_name = '%s-%s' % (prefix, num)
    270273        if batch_name in self.keys():
    271274            raise KeyError('Batch already exists: %s' % batch_name)
    272         #batch = AccessCodeBatch(
    273         #    datetime.now(), creator, entry['serial'], cost, 0, num=num)
    274275        batch = AccessCodeBatch(
    275             datetime.now(), creator, entry['serial'], cost, 0, num=0)
     276            datetime.now(), creator, prefix, cost, 0, num=num)
    276277        num_entries = 0
    277278        self[batch_name] = batch
Note: See TracChangeset for help on using the changeset viewer.