[places] adding world_region tag and adding the phrase West Indies with small random probability for English-speaking Caribbean nations. Ref: #113
This commit is contained in:
@@ -75,6 +75,7 @@ class AddressFormatter(object):
|
||||
POSTCODE = 'postcode'
|
||||
COUNTRY_REGION = 'country_region'
|
||||
COUNTRY = 'country'
|
||||
WORLD_REGION = 'world_region'
|
||||
|
||||
component_order = {k: i for i, k in enumerate([
|
||||
CATEGORY,
|
||||
@@ -102,6 +103,7 @@ class AddressFormatter(object):
|
||||
POSTCODE,
|
||||
COUNTRY_REGION,
|
||||
COUNTRY,
|
||||
WORLD_REGION,
|
||||
])}
|
||||
|
||||
BOUNDARY_COMPONENTS_ORDERED = [
|
||||
@@ -115,6 +117,7 @@ class AddressFormatter(object):
|
||||
STATE,
|
||||
COUNTRY_REGION,
|
||||
COUNTRY,
|
||||
WORLD_REGION,
|
||||
]
|
||||
|
||||
BOUNDARY_COMPONENTS = set(BOUNDARY_COMPONENTS_ORDERED)
|
||||
@@ -153,6 +156,7 @@ class AddressFormatter(object):
|
||||
('county', STATE_DISTRICT),
|
||||
('state_code', STATE),
|
||||
('country_name', COUNTRY),
|
||||
('continent', WORLD_REGION),
|
||||
('postal_code', POSTCODE),
|
||||
('post_code', POSTCODE),
|
||||
])
|
||||
|
||||
@@ -30,6 +30,7 @@ class PlaceConfig(object):
|
||||
AddressFormatter.STATE,
|
||||
AddressFormatter.COUNTRY_REGION,
|
||||
AddressFormatter.COUNTRY,
|
||||
AddressFormatter.WORLD_REGION,
|
||||
}
|
||||
|
||||
numeric_ops = (('lte', operator.le),
|
||||
@@ -139,6 +140,13 @@ class PlaceConfig(object):
|
||||
value = components[component]
|
||||
for c in names[value]:
|
||||
new_components.pop(c, None)
|
||||
|
||||
for component in self.ADMIN_COMPONENTS:
|
||||
value = self.get_property(('components', component, 'value'), country=country, default=None)
|
||||
|
||||
if value is not None and component not in components and self.include_component(component, containing_ids, country=country, population=population):
|
||||
new_components[component] = value
|
||||
|
||||
return new_components
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user