1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #16553 -- Refactored the GeoIP module, moving it django.contrib.gis.geoip; fixed memory leaks, and encoding issues.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16783 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Justin Bronn
2011-09-10 18:04:27 +00:00
parent efb8327444
commit 05e29716b4
12 changed files with 470 additions and 399 deletions

View File

@@ -239,6 +239,10 @@ their deprecation, as per the :ref:`deprecation policy
were deprecated since Django 1.4 and will be removed in favor
of the ``django.utils.text.Truncator`` class.
* The :class:`~django.contrib.gis.geoip.GeoIP` class was moved to
:mod:`django.contrib.gis.geoip` in 1.4 -- the shortcut in
:mod:`django.contrib.gis.utils` will be removed.
2.0
---

View File

@@ -4,10 +4,17 @@
Geolocation with GeoIP
======================
.. module:: django.contrib.gis.utils.geoip
.. module:: django.contrib.gis.geoip
:synopsis: High-level Python interface for MaxMind's GeoIP C library.
.. currentmodule:: django.contrib.gis.utils
.. 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
`MaxMind GeoIP C API`__. [#]_ This interface is a BSD-licensed alternative
@@ -136,7 +143,7 @@ Querying
All the following querying routines may take either a string IP address
or a fully qualified domain name (FQDN). For example, both
``'24.124.1.80'`` and ``'djangoproject.com'`` would be valid query
``'205.186.163.125'`` and ``'djangoproject.com'`` would be valid query
parameters.
.. method:: GeoIP.city(query)
@@ -144,7 +151,7 @@ parameters.
Returns a dictionary of city information for the given query. Some
of the values in the dictionary may be undefined (``None``).
.. method:: GeoIPcountry(query)
.. method:: GeoIP.country(query)
Returns a dictionary with the country code and country for the given
query.
@@ -190,7 +197,7 @@ This property returns information about the GeoIP city database.
.. attribute:: GeoIP.info
This property returns information about all GeoIP databases (both city
and country).
and country), and the version of the GeoIP C library (if supported).
GeoIP-Python API compatibility methods
----------------------------------------

View File

@@ -22,6 +22,7 @@ of spatially enabled data.
measure
geos
gdal
geoip
utils
commands
admin

View File

@@ -13,20 +13,5 @@ useful in creating geospatial Web applications.
.. toctree::
:maxdepth: 2
geoip
layermapping
ogrinspect
GeoIP
=====
Interface to the MaxMind GeoIP library for performing IP-based geolocation
from GeoDjango. See :ref:`GeoIP reference <ref-geoip>` documentation for
more information.
LayerMapping
============
The :class:`~django.contrib.gis.utils.LayerMapping` simplifies the process
of importing spatial data and attributes into your GeoDjango models.