[fix] allow only house_number with no street in OpenAddresses Japan
This commit is contained in:
@@ -48,6 +48,8 @@ SPANISH = 'es'
|
|||||||
PORTUGUESE = 'pt'
|
PORTUGUESE = 'pt'
|
||||||
RUSSIAN = 'ru'
|
RUSSIAN = 'ru'
|
||||||
|
|
||||||
|
JAPAN = 'jp'
|
||||||
|
|
||||||
|
|
||||||
class OpenAddressesFormatter(object):
|
class OpenAddressesFormatter(object):
|
||||||
field_regex_replacements = {
|
field_regex_replacements = {
|
||||||
@@ -393,7 +395,7 @@ class OpenAddressesFormatter(object):
|
|||||||
unit = components.get(AddressFormatter.UNIT, None)
|
unit = components.get(AddressFormatter.UNIT, None)
|
||||||
|
|
||||||
# If there's a postcode, we can still use just the city/state/postcode, otherwise discard
|
# If there's a postcode, we can still use just the city/state/postcode, otherwise discard
|
||||||
if not (street and house_number) or street.lower() == house_number.lower() or (unit and street and street.lower() == unit.lower()):
|
if ((not street or country == JAPAN) and not house_number) or (street and house_number and (street.lower() == house_number.lower())) or (unit and street and street.lower() == unit.lower()):
|
||||||
if not postcode:
|
if not postcode:
|
||||||
continue
|
continue
|
||||||
components = self.components.drop_address(components)
|
components = self.components.drop_address(components)
|
||||||
|
|||||||
Reference in New Issue
Block a user