This site is an archive; learn more about 8 years of OpenHatch.

[OH-Dev] [issue919] Sometimes /account/settings/location/ crashes

Asheesh Laroia bugs at openhatch.org
Sun Jan 12 06:54:45 UTC 2014


New submission from Asheesh Laroia <asheesh at asheesh.org>:

This is the traceback:

Traceback (most recent call last):

  File "/home/deploy/milestone-
a.buildout/vendor/packages/Django/django/core/handlers/base.py", line 111, in 
get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/home/deploy/milestone-
a.buildout/vendor/packages/Django/django/contrib/auth/decorators.py", line 23, 
in _wrapped_view
    return view_func(request, *args, **kwargs)

  File "<string>", line 2, in set_location

  File "/home/deploy/milestone-a.buildout/mysite/base/decorators.py", line 73, 
in view
    request, template, view_data = func(*args, **kw)

  File "/home/deploy/milestone-a.buildout/mysite/account/views.py", line 290, in 
set_location
    mysite.base.middleware.get_user_ip(request))[1]

  File "/home/deploy/milestone-a.buildout/mysite/profile/view_helpers.py", line 
142, in get_geoip_guess_for_ip
    country_name = geoip_database.country_name_by_addr(ip_as_string)

  File "/home/deploy/milestone-
a.buildout/vendor/packages/pygeoip/pygeoip/__init__.py", line 467, in 
country_name_by_addr
    return self.record_by_addr(addr)['country_name']

TypeError: 'NoneType' object is unsubscriptable


In my opinion, the view_helpers.py get_geoip_guess_for_ip() function should 
catch TypeError and do something reasonable in that situation.

This causes real users to hit our Error 500 page, which is sad.

----------
messages: 4048
nosy: paulproteus
priority: urgent
status: unread
title: Sometimes /account/settings/location/ crashes

__________________________________________
Roundup issue tracker <bugs at openhatch.org>
<https://openhatch.org/bugs/issue919>
__________________________________________


More information about the Devel mailing list