geolocation related fixes

pull/236/head
Igor Chubin 6 years ago
parent eed7c3597d
commit a45855fbb4

@ -116,9 +116,13 @@ def get_location(ip_addr):
Return location pair (CITY, COUNTRY) for `ip_addr`
"""
try:
response = GEOIP_READER.city(ip_addr)
country = response.country.name
city = response.city.name
except geoip2.errors.AddressNotFoundError:
country = None
city = None
#
# temporary disabled it because of geoip services capcacity

@ -72,7 +72,7 @@ def render_location(data):
location (l)
"""
return data['location']
return data['location'].title()
FORMAT_SYMBOL = {
'c': render_condition,

Loading…
Cancel
Save