Changeset 8478
- Timestamp:
- 21 May 2012, 07:17:50 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/tools/fix_import_file.py
r7666 r8478 40 40 # Converter (see below) 41 41 OPTIONS = { 42 'student_id': 'student_id', 42 43 'sex': 'gender', 43 44 'birthday': 'date', … … 52 53 'password': 'password', 53 54 'phone': 'phone', 55 'nationality': 'nationality', 54 56 'level': 'level', 55 57 'start_level': 'level', … … 66 68 COLNAME_MAPPING = { 67 69 # base data 70 'reg_state': 'state', 68 71 'jamb_reg_no': 'reg_number', 69 72 'matric_no': 'matric_number', … … 94 97 } 95 98 96 # Mapping input regh_state --> output reg_state99 # Mapping input state --> output state 97 100 REGSTATE_MAPPING = { 98 101 'student_created': 'created', … … 128 131 """Converters to turn old-style values into new ones. 129 132 """ 133 134 @classmethod 135 def student_id(self, value): 136 """ 'A123456' --> 'EA123456' 137 """ 138 if len(value) == 7: 139 return 'E' + value 140 return value 141 130 142 @classmethod 131 143 def reg_state(self, value): … … 183 195 def session(self, value): 184 196 """ '08' --> '2008' 185 """ 197 '2008/2009' --> '2008' 198 """ 199 if '/' in value: 200 numbers = value.split('/') 201 number = int(numbers[0]) 202 if number in range(2000,2015): 203 return number 204 else: 205 return 9999 186 206 try: 187 207 number = int(value) … … 274 294 275 295 @classmethod 296 def nationality(self, value): 297 if value == "nigeria": 298 return "NG" 299 return value 300 301 @classmethod 276 302 def phone(self, value): 277 303 """ '<num-seq1>-<num-seq2> asd' -> '--<num-seq1><num-seq2>' … … 284 310 match = RE_PHONE.match(value) 285 311 phone = match.groups()[0] 286 value = '- -%s' % phone312 value = '-%s' % phone 287 313 return value 288 314
Note: See TracChangeset for help on using the changeset viewer.