Changeset 7575 for main/waeup.sirp
- Timestamp:
- 2 Feb 2012, 23:03:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/tools/fix_import_file.py
r7574 r7575 31 31 import csv 32 32 import datetime 33 import re 33 34 import sys 34 35 … … 48 49 'reg_state': 'reg_state', 49 50 'password': 'password', 51 'phone': 'phone', 50 52 } 51 53 … … 82 84 ## 83 85 86 # Look for the first sequence of numbers 87 RE_PHONE = re.compile('[^\d]*(\d*)[^\d]*') 88 84 89 def convert_fieldnames(fieldnames): 85 90 """Replace input fieldnames by fieldnames of COLNAME_MAPPING. … … 175 180 if value == "not set": 176 181 return "" 182 return value 183 184 @classmethod 185 def phone(self, value): 186 """ '<num-seq1>-<num-seq2> asd' -> '--<num-seq1><num-seq2>' 187 188 Dashes and slashes are removed before looking for sequences 189 of numbers. 190 """ 191 value = value.replace('-', '') 192 value = value.replace('/', '') 193 match = RE_PHONE.match(value) 194 phone = match.groups()[0] 195 value = '--%s' % phone 177 196 return value 178 197
Note: See TracChangeset for help on using the changeset viewer.