[fix] Dublin postcode formatting

This commit is contained in:
Al
2016-10-07 01:06:37 -04:00
parent 2e8b6e6a29
commit 4ff3f50e01

View File

@@ -705,7 +705,7 @@ class AddressComponents(object):
if postcode and (self.dublin_postal_district_regex.match(postcode) or self.dublin_city_district_regex.match(postcode)):
address_components.pop(AddressFormatter.POSTCODE)
return True
elif city.lower() in ('dublin', 'city of dublin', 'dublin city') and AddressFormatter.POSTCODE in address_components:
elif city and city.lower() in ('dublin', 'city of dublin', 'dublin city') and AddressFormatter.POSTCODE in address_components:
postcode = address_components[AddressFormatter.POSTCODE]
if self.dublin_postal_district_regex.match(postcode):
address_components.pop(AddressFormatter.CITY)