[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:
parent
66600b93c5
commit
c8e14f301f
|
@ -65,7 +65,7 @@ class ir_http(orm.AbstractModel):
|
||||||
import GeoIP
|
import GeoIP
|
||||||
# updated database can be downloaded on MaxMind website
|
# updated database can be downloaded on MaxMind website
|
||||||
# http://dev.maxmind.com/geoip/legacy/install/city/
|
# 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):
|
if os.path.exists(geofile):
|
||||||
self.geo_ip_resolver = GeoIP.open(geofile, GeoIP.GEOIP_STANDARD)
|
self.geo_ip_resolver = GeoIP.open(geofile, GeoIP.GEOIP_STANDARD)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -282,6 +282,8 @@ class configmanager(object):
|
||||||
type="int")
|
type="int")
|
||||||
group.add_option("--unaccent", dest="unaccent", my_default=False, action="store_true",
|
group.add_option("--unaccent", dest="unaccent", my_default=False, action="store_true",
|
||||||
help="Use the unaccent function provided by the database when available.")
|
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)
|
parser.add_option_group(group)
|
||||||
|
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
|
|
Loading…
Reference in New Issue