Code

#20384 closed Bug (fixed)

GeoIP doesn't support unicode path

Reported by: julian@… Owned by: nobody
Component: GIS Version: 1.5
Severity: Normal Keywords: geoip unicode
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If the path that GeoIP should use is a unicode object it will fail to properly parse/identify the GeoIP databases.

>>> from django.contrib.gis.geoip import GeoIP
>>> g = GeoIP(path='/path/to/GeoIP')
>>> g.info
'GeoIP Library:\n\t1.4.8\nCountry:\n\tGEO-106FREE [...]\nCity:\n\tGEO-533LITE [...]'
>>> g = GeoIP(path=u'/path/to/GeoIP')
>>> g.info
'GeoIP Library:\n\t1.4.8\nCountry:\n\t\nCity:\n\t'

Tested this on Python 2.7. The same effect occurs in py3k, but getting it to work there in the same way would require using byte literals in django/contrib/gis/geoip/base.py", line 92, in __init__.

Using Linux kernel 3.8.5-1-ARCH, ext4 filesystem and Python 2.7.4.

Attachments (0)

Change History (2)

comment:1 Changed 12 months ago by claudep

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

GeoIP definitely needs some love... I'll see what I can do.

comment:2 Changed 12 months ago by Claude Paroz <claude@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 465a29abe09012059b4a8ff34f1020f48879ad71:

Fixed #20384 -- Forced GeoIP_open path argument to bytestring

Thanks Julian Wachholz for the report.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.