Fixed KeyError Exception

This commit is contained in:
Antonio
2018-01-29 17:32:44 +01:00
parent fed444ff6c
commit 05718ce58c
3 changed files with 6 additions and 3 deletions

View File

@@ -23,7 +23,8 @@ RETURNS Geometry AS $$
country_iso3166 = None
if country:
country_iso3 = country_to_iso3(country)
country_iso3166 = countries.get(country_iso3).alpha2.lower()
if country_iso3:
country_iso3166 = countries.get(country_iso3).alpha2.lower()
coordinates = geocoder.geocode(searchtext=searchtext, city=city,
state_province=state_province,

View File

@@ -2078,7 +2078,8 @@ RETURNS Geometry AS $$
country_iso3166 = None
if country:
country_iso3 = country_to_iso3(country)
country_iso3166 = countries.get(country_iso3).alpha2.lower()
if country_iso3:
country_iso3166 = countries.get(country_iso3).alpha2.lower()
coordinates = geocoder.geocode(searchtext=searchtext, city=city,
state_province=state_province,

View File

@@ -203,7 +203,8 @@ RETURNS Geometry AS $$
country_iso3166 = None
if country:
country_iso3 = country_to_iso3(country)
country_iso3166 = countries.get(country_iso3).alpha2.lower()
if country_iso3:
country_iso3166 = countries.get(country_iso3).alpha2.lower()
coordinates = geocoder.geocode(searchtext=searchtext, city=city,
state_province=state_province,