1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
From: Tapio Rantala <tapio.rantala@iki.fi>
Date: Sun, 11 Oct 2015 11:43:20 +1100
Subject: Use Debian GeoIP database path as default
Default to Debian standard path for GeoIP directory and for GeoIP city
file. Avoids the need to declare them in each project.
.
This is a Debian specific patch.
Bug-Debian: http://bugs.debian.org/645094
Forwarded: not-needed
Patch-Name: 06_use_debian_geoip_database_as_default.diff
---
django/contrib/gis/geoip2.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/django/contrib/gis/geoip2.py b/django/contrib/gis/geoip2.py
index 5b510dee7f96..e281bbac829a 100644
--- a/django/contrib/gis/geoip2.py
+++ b/django/contrib/gis/geoip2.py
@@ -79,6 +79,7 @@ class GeoIP2:
to where the city or country data files (*.mmdb) are located.
Assumes that both the city and country data sets are located in
this directory; overrides the GEOIP_PATH setting.
+ If neither is set, defaults to '/usr/share/GeoIP'.
* cache: The cache settings when opening up the GeoIP datasets. May be
an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO,
@@ -87,17 +88,17 @@ class GeoIP2:
meaning MODE_AUTO.
* country: The name of the GeoIP country data file. Defaults to
- 'GeoLite2-Country.mmdb'; overrides the GEOIP_COUNTRY setting.
+ 'GeoIPdat'; overrides the GEOIP_COUNTRY setting.
* city: The name of the GeoIP city data file. Defaults to
- 'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting.
+ 'GeoIPCity.dat'; overrides the GEOIP_CITY setting.
"""
if cache not in self.cache_options:
raise GeoIP2Exception("Invalid GeoIP caching option: %s" % cache)
- path = path or getattr(settings, "GEOIP_PATH", None)
- city = city or getattr(settings, "GEOIP_CITY", "GeoLite2-City.mmdb")
- country = country or getattr(settings, "GEOIP_COUNTRY", "GeoLite2-Country.mmdb")
+ path = path or getattr(settings, "GEOIP_PATH", "/usr/share/GeoIP")
+ city = city or getattr(settings, "GEOIP_CITY", "GeoIPCity.mmdb")
+ country = country or getattr(settings, "GEOIP_COUNTRY", "GeoIP.dat")
if not path:
raise GeoIP2Exception(
|