Changeset 4507 for waeup


Ignore:
Timestamp:
31 Jul 2009, 23:21:33 (15 years ago)
Author:
uli
Message:

Type cast values during import of courses.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/branches/ulif-rewrite/src/waeup/utils/csvimport.py

    r4481 r4507  
    117117            del row['department']
    118118
     119            # Type casts...
     120            if row['semester'] == '1,2':
     121                row['semester'] = 3
     122            for key in ['semester', 'credits', 'passmark']:
     123                if row[key] == '' or row[key] == 'None':
     124                    row[key] = None
     125                    continue
     126                row[key] = int(row[key])
     127
    119128            for key, val in row.items():
    120129                setattr(new_item, key, val)
Note: See TracChangeset for help on using the changeset viewer.