summaryrefslogtreecommitdiff
path: root/addons/http_routing/geoipresolver.py
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-05-14 20:25:16 +0200
committerChristophe Simonis <chs@odoo.com>2018-05-14 20:25:16 +0200
commit45b4a4a4dd09fa6d8a2e18e52adf542f015124d7 (patch)
tree37dce25790962e677520f6abdffcb364df86abcb /addons/http_routing/geoipresolver.py
parent2b771757e2d02d1300400f743e9cae41dc7cf40f (diff)
parent62d93dad02f96e175043c03bd60df2f68885ff7e (diff)
[MERGE] forward port branch saas-15 up to 62d93dad02f
Diffstat (limited to 'addons/http_routing/geoipresolver.py')
-rw-r--r--addons/http_routing/geoipresolver.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/addons/http_routing/geoipresolver.py b/addons/http_routing/geoipresolver.py
index e95b9318eb2..24bbe723d6d 100644
--- a/addons/http_routing/geoipresolver.py
+++ b/addons/http_routing/geoipresolver.py
@@ -50,10 +50,10 @@ class GeoIPResolver(object):
# Compatibility with Legacy database.
# Some ips cannot be located to a specific country. Legacy DB used to locate them in
# continent instead of country. Do the same to not change behavior of existing code.
- country = r.country if r.country.geoname_id else r.continent
+ country, attr = (r.country, 'iso_code') if r.country.geoname_id else (r.continent, 'code')
return {
'city': r.city.name,
- 'country_code': country.iso_code,
+ 'country_code': getattr(country, attr),
'country_name': country.name,
'region': r.subdivisions[0].iso_code if r.subdivisions else None,
'time_zone': r.location.time_zone,