Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
b2d20e98
Kaydet (Commit)
b2d20e98
authored
Ara 24, 2012
tarafından
Aymeric Augustin
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Removed legacy shortcut for importing GeoIP.
üst
d4ea02b9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
52 deletions
+21
-52
__init__.py
django/contrib/gis/utils/__init__.py
+0
-8
geoip.py
django/contrib/gis/utils/geoip.py
+0
-14
geoip.txt
docs/ref/contrib/gis/geoip.txt
+21
-30
No files found.
django/contrib/gis/utils/__init__.py
Dosyayı görüntüle @
b2d20e98
...
@@ -14,12 +14,4 @@ if HAS_GDAL:
...
@@ -14,12 +14,4 @@ if HAS_GDAL:
except
:
except
:
pass
pass
# GeoIP now lives in `django.contrib.gis.geoip`; this shortcut will be
# removed in Django 1.6.
from
django.contrib.gis.utils
import
geoip
HAS_GEOIP
=
geoip
.
HAS_GEOIP
if
HAS_GEOIP
:
GeoIP
=
geoip
.
GeoIP
GeoIPException
=
geoip
.
GeoIPException
from
django.contrib.gis.utils.wkt
import
precision_wkt
from
django.contrib.gis.utils.wkt
import
precision_wkt
django/contrib/gis/utils/geoip.py
deleted
100644 → 0
Dosyayı görüntüle @
d4ea02b9
import
warnings
from
django.contrib.gis
import
geoip
HAS_GEOIP
=
geoip
.
HAS_GEOIP
if
HAS_GEOIP
:
BaseGeoIP
=
geoip
.
GeoIP
GeoIPException
=
geoip
.
GeoIPException
class
GeoIP
(
BaseGeoIP
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
warnings
.
warn
(
'GeoIP class has been moved to `django.contrib.gis.geoip`, and '
'this shortcut will disappear in Django v1.6.'
,
DeprecationWarning
,
stacklevel
=
2
)
super
(
GeoIP
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
docs/ref/contrib/gis/geoip.txt
Dosyayı görüntüle @
b2d20e98
...
@@ -7,22 +7,13 @@ Geolocation with GeoIP
...
@@ -7,22 +7,13 @@ Geolocation with GeoIP
.. module:: django.contrib.gis.geoip
.. module:: django.contrib.gis.geoip
:synopsis: High-level Python interface for MaxMind's GeoIP C library.
:synopsis: High-level Python interface for MaxMind's GeoIP C library.
.. versionchanged:: 1.4
.. note::
In Django 1.4, the :class:`GeoIP` object was moved out of
:mod:`django.contrib.gis.utils` and into its own module,
:mod:`django.contrib.gis.geoip`. A shortcut is still provided
in ``utils``, but will be removed in Django 1.6.
The :class:`GeoIP` object is a ctypes wrapper for the
The :class:`GeoIP` object is a ctypes wrapper for the
`MaxMind GeoIP C API`__. [#]_ This interface is a BSD-licensed alternative
`MaxMind GeoIP C API`__. [#]_ This interface is a BSD-licensed alternative
to the GPL-licensed `Python GeoIP`__ interface provided by MaxMind.
to the GPL-licensed `Python GeoIP`__ interface provided by MaxMind.
In order to perform IP-based geolocation, the :class:`GeoIP` object requires
In order to perform IP-based geolocation, the :class:`GeoIP` object requires
the GeoIP C libary and either the GeoIP `Country`__ or `City`__
the GeoIP C libary and either the GeoIP `Country`__ or `City`__
datasets in binary format (the CSV files will not work!). These datasets may be
datasets in binary format (the CSV files will not work!). These datasets may be
`downloaded from MaxMind`__. Grab the ``GeoLiteCountry/GeoIP.dat.gz`` and
`downloaded from MaxMind`__. Grab the ``GeoLiteCountry/GeoIP.dat.gz`` and
``GeoLiteCity.dat.gz`` files and unzip them in a directory corresponding to what
``GeoLiteCity.dat.gz`` files and unzip them in a directory corresponding to what
you set :setting:`GEOIP_PATH` with in your settings. See the example and
you set :setting:`GEOIP_PATH` with in your settings. See the example and
...
@@ -58,7 +49,7 @@ usage::
...
@@ -58,7 +49,7 @@ usage::
>>> g.lat_lon('salon.com')
>>> g.lat_lon('salon.com')
(37.789798736572266, -122.39420318603516)
(37.789798736572266, -122.39420318603516)
>>> g.lon_lat('uh.edu')
>>> g.lon_lat('uh.edu')
(-95.415199279785156, 29.77549934387207)
(-95.415199279785156, 29.77549934387207)
>>> g.geos('24.124.1.80').wkt
>>> g.geos('24.124.1.80').wkt
'POINT (-95.2087020874023438 39.0392990112304688)'
'POINT (-95.2087020874023438 39.0392990112304688)'
...
@@ -104,30 +95,30 @@ Defaults to ``'GeoLiteCity.dat'``.
...
@@ -104,30 +95,30 @@ Defaults to ``'GeoLiteCity.dat'``.
.. class:: GeoIP([path=None, cache=0, country=None, city=None])
.. class:: GeoIP([path=None, cache=0, country=None, city=None])
The ``GeoIP`` object does not require any parameters to use the default
The ``GeoIP`` object does not require any parameters to use the default
settings. However, at the very least the :setting:`GEOIP_PATH` setting
settings. However, at the very least the :setting:`GEOIP_PATH` setting
should be set with the path of the location of your GeoIP data sets. The
should be set with the path of the location of your GeoIP data sets. The
following intialization keywords may be used to customize any of the
following intialization keywords may be used to customize any of the
defaults.
defaults.
=================== =======================================================
=================== =======================================================
Keyword Arguments Description
Keyword Arguments Description
=================== =======================================================
=================== =======================================================
``path`` Base directory to where GeoIP data is located or the
``path`` Base directory to where GeoIP data is located or the
full path to where the city or country data files
full path to where the city or country data files
(.dat) are located. Assumes that both the city and
(.dat) are located. Assumes that both the city and
country data sets are located in this directory;
country data sets are located in this directory;
overrides the :setting:`GEOIP_PATH` settings attribute.
overrides the :setting:`GEOIP_PATH` settings attribute.
``cache`` The cache settings when opening up the GeoIP datasets,
``cache`` The cache settings when opening up the GeoIP datasets,
and may be an integer in (0, 1, 2, 4) corresponding to
and may be an integer in (0, 1, 2, 4) corresponding to
the ``GEOIP_STANDARD``, ``GEOIP_MEMORY_CACHE``,
the ``GEOIP_STANDARD``, ``GEOIP_MEMORY_CACHE``,
``GEOIP_CHECK_CACHE``, and ``GEOIP_INDEX_CACHE``
``GEOIP_CHECK_CACHE``, and ``GEOIP_INDEX_CACHE``
``GeoIPOptions`` C API settings, respectively.
``GeoIPOptions`` C API settings, respectively.
Defaults to 0 (``GEOIP_STANDARD``).
Defaults to 0 (``GEOIP_STANDARD``).
``country`` The name of the GeoIP country data file. Defaults
``country`` The name of the GeoIP country data file. Defaults
to ``GeoIP.dat``. Setting this keyword overrides the
to ``GeoIP.dat``. Setting this keyword overrides the
:setting:`GEOIP_COUNTRY` settings attribute.
:setting:`GEOIP_COUNTRY` settings attribute.
``city`` The name of the GeoIP city data file. Defaults to
``city`` The name of the GeoIP city data file. Defaults to
...
@@ -142,9 +133,9 @@ Querying
...
@@ -142,9 +133,9 @@ Querying
--------
--------
All the following querying routines may take either a string IP address
All the following querying routines may take either a string IP address
or a fully qualified domain name (FQDN). For example, both
or a fully qualified domain name (FQDN). For example, both
``'205.186.163.125'`` and ``'djangoproject.com'`` would be valid query
``'205.186.163.125'`` and ``'djangoproject.com'`` would be valid query
parameters.
parameters.
.. method:: GeoIP.city(query)
.. method:: GeoIP.city(query)
...
@@ -153,7 +144,7 @@ of the values in the dictionary may be undefined (``None``).
...
@@ -153,7 +144,7 @@ of the values in the dictionary may be undefined (``None``).
.. method:: GeoIP.country(query)
.. method:: GeoIP.country(query)
Returns a dictionary with the country code and country for the given
Returns a dictionary with the country code and country for the given
query.
query.
.. method:: GeoIP.country_code(query)
.. method:: GeoIP.country_code(query)
...
@@ -202,7 +193,7 @@ and country), and the version of the GeoIP C library (if supported).
...
@@ -202,7 +193,7 @@ and country), and the version of the GeoIP C library (if supported).
GeoIP-Python API compatibility methods
GeoIP-Python API compatibility methods
----------------------------------------
----------------------------------------
These methods exist to ease compatibility with any code using MaxMind's
These methods exist to ease compatibility with any code using MaxMind's
existing Python API.
existing Python API.
.. classmethod:: GeoIP.open(path, cache)
.. classmethod:: GeoIP.open(path, cache)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment