[osm] parsing out semicolon-delimited postal codes from OSM in countries like Poland that use hyphen delimited postcodes without treating them as number ranges
This commit is contained in:
@@ -457,11 +457,14 @@ class OSMAddressFormatter(object):
|
|||||||
valid_postcode = False
|
valid_postcode = False
|
||||||
if validate:
|
if validate:
|
||||||
postcode_regex = postcode_regexes.get(country)
|
postcode_regex = postcode_regexes.get(country)
|
||||||
|
values = number_split_regex.split(postal_code)
|
||||||
|
|
||||||
if postcode_regex:
|
if postcode_regex:
|
||||||
match = postcode_regex.match(postal_code)
|
for p in values:
|
||||||
if match and match.end() == len(postal_code):
|
match = postcode_regex.match(p)
|
||||||
valid_postcode = True
|
if match and match.end() == len(p):
|
||||||
postal_codes.append(postal_code)
|
valid_postcode = True
|
||||||
|
postal_codes.append(p)
|
||||||
else:
|
else:
|
||||||
valid_postcode = True
|
valid_postcode = True
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user