From 17912522cee1277c8c126394fbe94b7172f92e83 Mon Sep 17 00:00:00 2001 From: Baptiste Mispelon Date: Sun, 24 Nov 2013 14:32:57 +0100 Subject: [PATCH] Fixed #21504 -- Don't shadow database errors when testing for postgis version. Thanks to trac user paultag for the report. --- django/contrib/gis/db/backends/postgis/operations.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py index 1a71be681c7..86608afa35b 100644 --- a/django/contrib/gis/db/backends/postgis/operations.py +++ b/django/contrib/gis/db/backends/postgis/operations.py @@ -9,7 +9,7 @@ from django.contrib.gis.geometry.backend import Geometry from django.contrib.gis.measure import Distance from django.core.exceptions import ImproperlyConfigured from django.db.backends.postgresql_psycopg2.base import DatabaseOperations -from django.db.utils import DatabaseError +from django.db.utils import ProgrammingError from django.utils import six from django.utils.functional import cached_property @@ -258,7 +258,7 @@ class PostGISOperations(DatabaseOperations, BaseSpatialOperations): else: try: vtup = self.postgis_version_tuple() - except DatabaseError: + except ProgrammingError: raise ImproperlyConfigured( 'Cannot determine PostGIS version for database "%s". ' 'GeoDjango requires at least PostGIS version 1.3. '