[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']
This commit is contained in:
Jeremy Kersten 2014-10-13 16:47:12 +02:00
parent 66600b93c5
commit c8e14f301f
2 changed files with 3 additions and 1 deletions

View 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:

View 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':