Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

GeoIPException is not imported, so use generic Exception class #103

Closed
wants to merge 1 commit into from

2 participants

Bouke Haarsma Florian Apolloner
Bouke Haarsma
Bouke commented June 03, 2012

When using GeoIP without defining the GeoIP library path, an exception is thrown. However, an incorrect exception class is used an the real exception is hidden.

Expected result:

Exception at /test/geoip/
Could not find the GeoIP library (tried "GeoIP"). Try setting GEOIP_LIBRARY_PATH in your settings.
Request Method: GET
Request URL:    http://localhost:8000/test/geoip/
Django Version: 1.4
Exception Type: Exception
Exception Value:    
Could not find the GeoIP library (tried "GeoIP"). Try setting GEOIP_LIBRARY_PATH in your settings.

Actual result:

NameError at /test/geoip/
name 'GeoIPException' is not defined
Request Method: GET
Request URL:    http://localhost:8000/test/geoip/
Django Version: 1.4
Exception Type: NameError
Exception Value:    
name 'GeoIPException' is not defined
Exception Location: /django/contrib/gis/geoip/libgeoip.py in <module>, line 22
Florian Apolloner
Owner

Fixed in cf7afeb, thx for the report.

Florian Apolloner apollo13 closed this January 01, 2013
Bouke Haarsma Bouke deleted the branch January 01, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Jun 03, 2012
Bouke Haarsma GeoIPException is not imported, so use generic Exception class 1f3cc2d
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  django/contrib/gis/geoip/libgeoip.py
4  django/contrib/gis/geoip/libgeoip.py
@@ -19,8 +19,8 @@
19 19
 
20 20
 # Getting the path to the GeoIP library.
21 21
 if lib_name: lib_path = find_library(lib_name)
22  
-if lib_path is None: raise GeoIPException('Could not find the GeoIP library (tried "%s"). '
23  
-                                          'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
  22
+if lib_path is None: raise Exception('Could not find the GeoIP library (tried "%s"). '
  23
+                                     'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
24 24
 lgeoip = CDLL(lib_path)
25 25
 
26 26
 # Getting the C `free` for the platform.
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.