~ubuntu-branches/ubuntu/saucy/python-django/saucy-updates

« back to all changes in this revision

Viewing changes to django/contrib/gis/geoip/base.py

  • Committer: Package Import Robot
  • Author(s): Luke Faraone, Jakub Wilk, Luke Faraone
  • Date: 2013-05-09 15:10:47 UTC
  • mfrom: (1.1.21) (4.4.27 sid)
  • Revision ID: package-import@ubuntu.com-20130509151047-aqv8d71oj9wvcv8c
Tags: 1.5.1-2
[ Jakub Wilk ]
* Use canonical URIs for Vcs-* fields.

[ Luke Faraone ]
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
    GeoIP_country_code_by_addr, GeoIP_country_code_by_name,
11
11
    GeoIP_country_name_by_addr, GeoIP_country_name_by_name)
12
12
 
 
13
from django.utils import six
 
14
 
13
15
# Regular expressions for recognizing the GeoIP free database editions.
14
16
free_regex = re.compile(r'^GEO-\d{3}FREE')
15
17
lite_regex = re.compile(r'^GEO-\d{3}LITE')
88
90
        # Getting the GeoIP data path.
89
91
        if not path:
90
92
            path = GEOIP_SETTINGS.get('GEOIP_PATH', '/usr/share/GeoIP')
91
 
        if not isinstance(path, basestring):
 
93
        if not isinstance(path, six.string_types):
92
94
            raise TypeError('Invalid path type: %s' % type(path).__name__)
93
95
 
94
96
        if os.path.isdir(path):
131
133
    def _check_query(self, query, country=False, city=False, city_or_country=False):
132
134
        "Helper routine for checking the query and database availability."
133
135
        # Making sure a string was passed in for the query.
134
 
        if not isinstance(query, basestring):
 
136
        if not isinstance(query, six.string_types):
135
137
            raise TypeError('GeoIP query must be a string, not type %s' % type(query).__name__)
136
138
 
137
139
        # GeoIP only takes ASCII-encoded strings.