From c8e14f301f2ecdd8ff4ddbf032edddea323a3411 Mon Sep 17 00:00:00 2001 From: Jeremy Kersten Date: Mon, 13 Oct 2014 16:47:12 +0200 Subject: [PATCH] [FIX] GeoIP - allow to specify the path to GeoIP in the server config. --geoip_db='the_path' which can be used via openerp.tool.config['geoip_database'] --- addons/website/models/ir_http.py | 2 +- openerp/tools/config.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py index bee78eb1cf3..7da212998c8 100644 --- a/addons/website/models/ir_http.py +++ b/addons/website/models/ir_http.py @@ -65,7 +65,7 @@ class ir_http(orm.AbstractModel): import GeoIP # updated database can be downloaded on MaxMind website # http://dev.maxmind.com/geoip/legacy/install/city/ - geofile = config.get('geoip_database', '/usr/share/GeoIP/GeoLiteCity.dat') + geofile = config.get('geoip_database') if os.path.exists(geofile): self.geo_ip_resolver = GeoIP.open(geofile, GeoIP.GEOIP_STANDARD) else: diff --git a/openerp/tools/config.py b/openerp/tools/config.py index 3fb940e1639..0dbc29f8471 100644 --- a/openerp/tools/config.py +++ b/openerp/tools/config.py @@ -282,6 +282,8 @@ class configmanager(object): type="int") group.add_option("--unaccent", dest="unaccent", my_default=False, action="store_true", help="Use the unaccent function provided by the database when available.") + group.add_option("--geoip_db", dest="geoip_database", my_default='/usr/share/GeoIP/GeoLiteCity.dat', action="store_true", + help="Absolute path to the GeoIP database file.") parser.add_option_group(group) if os.name == 'posix':