Code

Changes between Initial Version and Version 4 of Ticket #19168


Ignore:
Timestamp:
11/13/12 14:22:43 (17 months ago)
Author:
aaugustin
Comment:

Fixed formatting -- please use preview.

If I understand correctly, the problem only occurs when GEOIP_PATH is a unicode rather than a str.

The short answer is "make sure settings.PROJECT_DIR is a str". But in your case the path only contains ASCII characters so it shouldn't make any difference.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19168

    • Property Status changed from new to reopened
    • Property Patch needs improvement unset
    • Property Needs tests unset
    • Property Needs documentation unset
    • Property Triage Stage changed from Unreviewed to Accepted
  • Ticket #19168 – Description

    initial v4  
    22 
    33Here is example: 
     4{{{ 
    45# Settings 
    56GEOIP_PATH                         = os.path.join(PROJECT_DIR, 'bin', 'GeoIP') 
    67GEOIP_COUNTRY                  = 'GeoIP.dat' 
    78GEOIP_CITY                          = 'GeoLiteCity.dat' 
     9}}} 
    810 
     11{{{ 
    912In [1]: from django.contrib.gis.geoip import GeoIP 
    1013In [2]: geo = GeoIP() 
     
    1720In [6]: geo.city('8.8.8.8') 
    1821Invalid database type GeoIP Country Edition, expected GeoIP City Edition, Rev 1 
     22}}} 
    1923 
    2024Doing same thing passing the path as parameters: 
    2125 
     26{{{ 
    2227In [7]: geo = GeoIP(city='/Users/tejindersingh/Projects/kyb/bin/GeoIP/GeoLiteCity.dat', country='/Users/tejindersingh/Projects/kyb/bin/GeoIP/GeoIP.dat') 
    2328In [8]: geo.info 
     
    4146 'postal_code': u'94043', 
    4247 'region': u'CA'} 
     48}}} 
    4349 
    4450This happens under ox X mountain lion and with kyngchaos gis/gdal binary packages as well as self compile brews.