[Django] #20389: TypeError when executing example code of GeoIP

11 views
Skip to first unread message

Django

unread,
May 10, 2013, 11:52:53 AM5/10/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
-------------------------------+-----------------------------
Reporter: anonymous | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.5
Severity: Normal | Keywords: geoip TypeError
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+-----------------------------
I tried to execute example code from [1] and i found a TypeError on the
line ''g.country('google.com')''.

You can see the traceback here in [2].

I'm using Python 3.2.3 and Django 1.5.1.

[1] https://docs.djangoproject.com/en/1.5/ref/contrib/gis/geoip/
[2] http://pastebin.com/KdUZ7cmv

--
Ticket URL: <https://code.djangoproject.com/ticket/20389>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
May 10, 2013, 12:01:00 PM5/10/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new
Component: Python 3 | Version: 1.5
Severity: Normal | Resolution:
Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* component: Uncategorized => Python 3
* needs_tests: => 0
* needs_docs: => 0
* type: Uncategorized => Bug
* stage: Unreviewed => Accepted


Comment:

I'm copying the paste here before it expires:

{{{
$ python3 manage.py shell
Python 3.2.3 (default, May 6 2013, 01:46:35)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.gis.geoip import GeoIP
>>> g = GeoIP()
>>> g.country('google.com')
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python3.2/dist-
packages/django/contrib/gis/geoip/base.py", line 194, in country
return {'country_code' : self.country_code(query),
File "/usr/local/lib/python3.2/dist-
packages/django/contrib/gis/geoip/base.py", line 169, in country_code
if ipv4_re.match(query):
TypeError: can't use a string pattern on a bytes-like object
}}}

Thanks for the report. Most likely this feature isn't tested and it
slipped through when we ported Django to Python 3.

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:1>

Django

unread,
May 10, 2013, 12:51:06 PM5/10/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by claudep):

* status: new => closed
* resolution: => fixed


Comment:

I just fixed this this morning: [7b00d90208e998debc60e51cadb352645c91e3fd]

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:2>

Django

unread,
Aug 22, 2013, 2:34:21 PM8/22/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: new

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution:
Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by anonymous):

* status: closed => new
* resolution: fixed =>


Comment:

I'm the original reporter. The bug is still in django 1.5.2 as reported 3
months ago.

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:3>

Django

unread,
Aug 22, 2013, 3:48:10 PM8/22/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody
Type: Bug | Status: closed

Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: fixed

Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by aaugustin):

* status: new => closed
* resolution: => fixed


Comment:

It's fixed in master and in 1.6.

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:4>

Django

unread,
Aug 23, 2013, 1:18:50 PM8/23/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody

Type: Bug | Status: closed
Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: fixed
Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by anonymous):

aaugustin can you please point to the commit that fixes the problem so I
can copy it?

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:5>

Django

unread,
Aug 23, 2013, 3:36:44 PM8/23/13
to django-...@googlegroups.com
#20389: TypeError when executing example code of GeoIP
---------------------------------+------------------------------------
Reporter: anonymous | Owner: nobody

Type: Bug | Status: closed
Component: Python 3 | Version: 1.5
Severity: Normal | Resolution: fixed
Keywords: geoip TypeError | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------

Comment (by aaugustin):

There's a link in comment 2 which closed the ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/20389#comment:6>

Reply all
Reply to author
Forward
0 new messages