From 950e6183c60d368c62f627eaed54961be0a207d8 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Fri, 5 Oct 2012 14:38:01 -0700 Subject: [PATCH] Need to catch `ImproperlyConfigured` to be freed from the schackles of `DJANGO_SETTINGS_MODULE`. --- django/contrib/gis/gdal/libgdal.py | 5 +++-- django/contrib/gis/geos/libgeos.py | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/gdal/libgdal.py b/django/contrib/gis/gdal/libgdal.py index 7c6b128e0f..91f8d618fc 100644 --- a/django/contrib/gis/gdal/libgdal.py +++ b/django/contrib/gis/gdal/libgdal.py @@ -7,7 +7,7 @@ from ctypes import c_char_p, c_int, CDLL, CFUNCTYPE from ctypes.util import find_library from django.contrib.gis.gdal.error import OGRException - +from django.core.exceptions import ImproperlyConfigured logger = logging.getLogger('django.contrib.gis') @@ -15,7 +15,8 @@ logger = logging.getLogger('django.contrib.gis') try: from django.conf import settings lib_path = settings.GDAL_LIBRARY_PATH -except (AttributeError, EnvironmentError, ImportError): +except (AttributeError, EnvironmentError, + ImportError, ImproperlyConfigured): lib_path = None if lib_path: diff --git a/django/contrib/gis/geos/libgeos.py b/django/contrib/gis/geos/libgeos.py index d19644ac49..f011208ea0 100644 --- a/django/contrib/gis/geos/libgeos.py +++ b/django/contrib/gis/geos/libgeos.py @@ -13,7 +13,7 @@ from ctypes import c_char_p, Structure, CDLL, CFUNCTYPE, POINTER from ctypes.util import find_library from django.contrib.gis.geos.error import GEOSException - +from django.core.exceptions import ImproperlyConfigured logger = logging.getLogger('django.contrib.gis') @@ -21,7 +21,8 @@ logger = logging.getLogger('django.contrib.gis') try: from django.conf import settings lib_path = settings.GEOS_LIBRARY_PATH -except (AttributeError, EnvironmentError, ImportError): +except (AttributeError, EnvironmentError, + ImportError, ImproperlyConfigured): lib_path = None # Setting the appropriate names for the GEOS-C library.