Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

2 participants

@Bouke

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
@apollo13
Owner

Fixed in cf7afeb, thx for the report.

@apollo13 apollo13 closed this
@Bouke Bouke deleted the Bouke:patch-1 branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 2 deletions.
  1. +2 −2 django/contrib/gis/geoip/libgeoip.py
View
4 django/contrib/gis/geoip/libgeoip.py
@@ -19,8 +19,8 @@
# Getting the path to the GeoIP library.
if lib_name: lib_path = find_library(lib_name)
-if lib_path is None: raise GeoIPException('Could not find the GeoIP library (tried "%s"). '
- 'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
+if lib_path is None: raise Exception('Could not find the GeoIP library (tried "%s"). '
+ 'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
lgeoip = CDLL(lib_path)
# Getting the C `free` for the platform.
Something went wrong with that request. Please try again.