- Timestamp:
- 23 Jun 2012, 09:43:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/tools/fix_import_file.py
r8522 r8781 17 17 ## 18 18 """ 19 Fix exports from old SRP portal to make them importable by current portal. 19 Fix exports from old SRP portal and other data sources to make 20 them importable by current portal. 20 21 21 22 Usage: … … 28 29 Errors/warnings will be displayed on the shell, the output will be put 29 30 into the specified output file. 31 32 33 The lgas.py module must be copied into the same folder where this script 34 is started. 30 35 """ 31 36 import csv … … 33 38 import re 34 39 import sys 40 41 try: 42 from lgas import LGAS 43 except: 44 print 'ERROR: lgas.py is missing.' 45 sys.exit(1) 46 47 def strip(string): 48 string = string.replace('_', '') 49 string = string.replace('/', '') 50 string = string.replace('-', '') 51 string = string.replace(' ', '') 52 string = string.lower() 53 return string 54 55 LGAS_inverted_stripped = dict([(strip(i[1]), i[0]) for i in LGAS]) 56 LGAS_dict = dict(LGAS) 35 57 36 58 ## … … 189 211 except: 190 212 return '' 213 if value in LGAS_dict.keys(): 214 return value 215 # If real names are given, let's see if a similar value 216 # in LGAS exist. 217 value = LGAS_inverted_stripped.get(strip(value), value) 191 218 return value 192 219 … … 232 259 """ 'True'/'False' --> 'f'/'m' 233 260 """ 234 if value in (' True','f'):261 if value in ('F', 'True','f'): 235 262 value = 'f' 236 elif value in (' False','m'):263 elif value in ('M', 'False','m'): 237 264 value = 'm' 238 265 else:
Note: See TracChangeset for help on using the changeset viewer.