[fix] conditional + var name
This commit is contained in:
@@ -389,14 +389,14 @@ class OpenAddressesFormatter(object):
|
|||||||
if postcode:
|
if postcode:
|
||||||
components[AddressFormatter.POSTCODE] = postcode
|
components[AddressFormatter.POSTCODE] = postcode
|
||||||
elif AddressFormatter.POSTCODE in components:
|
elif AddressFormatter.POSTCODE in components:
|
||||||
component.pop(AddressFormatter.POSTCODE)
|
components.pop(AddressFormatter.POSTCODE)
|
||||||
|
|
||||||
unit = components.get(AddressFormatter.UNIT, None)
|
unit = components.get(AddressFormatter.UNIT, None)
|
||||||
|
|
||||||
street_not_required = country == Countries.JAPAN or country in Countries.FORMER_SOVIET_UNION_COUNTRIES
|
street_required = country != Countries.JAPAN and country not in Countries.FORMER_SOVIET_UNION_COUNTRIES
|
||||||
|
|
||||||
# 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 or street_not_required) 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 street and street_required 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