ceys / django-tracking

Automatically exported from code.google.com/p/django-tracking
MIT License
0 stars 0 forks source link

Library Update: Compatibility with PyGeoIP #9

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
We use django-tracking with pygeoip rather than the C implementation
because it can be added as an external to svn and distributed easily. 
However there are a couple of minor incompatibilities with django-tracking
at the moment:

1) import GeoIP fails (think adding a try for pygeoip.GeoIP will fix that)

2) GeoIP in pygeoIP uses GeoIP(filename, args) rather than
Geo.open(filename, args)

3) GEOIP_MEMORY_CACHE is now MEMORY_CACHE

At the moment I have written a bit of a dirty hack in
syspath\GeoIP\__init__.py that contains the following to sit between
django-tracking and pygeoip:

from pygeoip import GeoIP as PyGeoIP
from pygeoip import MEMORY_CACHE

GEOIP_MEMORY_CACHE = MEMORY_CACHE
def open(filename, flags):
    return PyGeoIP(filename, flags)

If you could correct these issues I would love to rid myself of the dirty
hack :)

Nick

Original issue reported on code.google.com by n...@itsnotworking.co.uk on 26 Jun 2009 at 4:12

GoogleCodeExporter commented 8 years ago
I've opted to go with Django's built-in GIS utilities, and this should remove 
the need for PyGeoIP AND the C API.

Original comment by wheaties...@gmail.com on 27 Dec 2010 at 5:47