[FIX] GeoIP - allow to specify the path to GeoIP in the server config.
authorJeremy Kersten <jke@odoo.com>
Mon, 13 Oct 2014 14:47:12 +0000 (16:47 +0200)
committerJeremy Kersten <jke@odoo.com>
Mon, 13 Oct 2014 14:47:12 +0000 (16:47 +0200)
--geoip_db='the_path'  which can be used via openerp.tool.config['geoip_database']

addons/website/models/ir_http.py
openerp/tools/config.py

index bee78eb..7da2129 100644 (file)
@@ -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:
index 3fb940e..0dbc29f 100644 (file)
@@ -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':