diff options
Diffstat (limited to 'archaeological_operations/utils.py')
-rw-r--r-- | archaeological_operations/utils.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py index 3a5057cd5..801cc6ea4 100644 --- a/archaeological_operations/utils.py +++ b/archaeological_operations/utils.py @@ -270,7 +270,7 @@ def parse_trunc_patriarche(value): int(value) except ValueError: return - return '18' + unicode(value) + return '18' + str(value) def parse_operation_code(value): @@ -468,11 +468,11 @@ def parse_insee(value): PARCEL_YEAR_REGEXP = re.compile(r"^([0-9]{4})[ :]+") PARCEL_SECTION_REGEXP = re.compile( - ur"(?: )*(?:[Ss]ection(?:s)?)?(?: )*([A-Z][A-Z0-9]{0,3})[ :]*" - ur"((?:(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*[0-9]+[p]?)+)") -PARCEL_NB_RANGE_REGEXP = re.compile(ur'([0-9]+[p]?) (?:à|to) ([0-9]+[p]?)') + r"(?: )*(?:[Ss]ection(?:s)?)?(?: )*([A-Z][A-Z0-9]{0,3})[ :]*" + r"((?:(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*[0-9]+[p]?)+)") +PARCEL_NB_RANGE_REGEXP = re.compile(r'([0-9]+[p]?) (?:à|to) ([0-9]+[p]?)') PARCEL_NB_REGEXP = re.compile( - ur'(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*([0-9]+[p]?)') + r'(?: |;|,|[Pp]arcelle(?:s)?|n°|et|à|to)*([0-9]+[p]?)') def parse_parcels(parcel_str, insee_code=None, owner=None): @@ -492,7 +492,7 @@ def parse_parcels(parcel_str, insee_code=None, owner=None): for parcel in PARCEL_SECTION_REGEXP.findall(parcel_str): sector, nums = parcel[0], parcel[1] for num in PARCEL_NB_REGEXP.findall(nums): - if len(unicode(num)) > 6: + if len(str(num)) > 6: continue dct = {'year': year, 'section': sector, 'parcel_number': num} if town: @@ -508,9 +508,9 @@ def parse_parcels(parcel_str, insee_code=None, owner=None): higher_range = int(higher_range) except ValueError: continue - for num in xrange(lower_range, higher_range): + for num in range(lower_range, higher_range): dct = {'year': year, 'section': sector, - 'parcel_number': unicode(num)} + 'parcel_number': str(num)} if town: dct['town'] = town if owner: |