[fix] conditional + var name

This commit is contained in:
Al
2017-01-27 19:20:41 -05:00
parent 987609ee8e
commit 72881ad315

View File

@@ -389,14 +389,14 @@ class OpenAddressesFormatter(object):
if postcode:
components[AddressFormatter.POSTCODE] = postcode
elif AddressFormatter.POSTCODE in components:
component.pop(AddressFormatter.POSTCODE)
components.pop(AddressFormatter.POSTCODE)
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 ((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:
continue
components = self.components.drop_address(components)