[fix] None case for names

This commit is contained in:
Al
2016-07-27 01:16:05 -04:00
parent 4e14926169
commit 3f4c18ddb6

View File

@@ -676,12 +676,12 @@ class AddressComponents(object):
for k in (key, name_key, raw_key, raw_name_key):
name = component_value.get(k)
if six.u(';') in name:
name = random.choice(name.split(six.u(';'))).strip()
elif six.u(',') in name:
name = name.split(six.u(','), 1)[0].strip()
if name and not (name == existing_city_name and component != AddressFormatter.CITY and drop_duplicate_city_names):
if six.u(';') in name:
name = random.choice(name.split(six.u(';'))).strip()
elif six.u(',') in name:
name = name.split(six.u(','), 1)[0].strip()
break
# if we've checked all keys without finding a valid name, leave this component out
else: