From 40a7292a8dbd94db481e3aed9177dfe8bad788a4 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Thu, 13 Dec 2007 03:08:06 +0000 Subject: [PATCH] gis: gdal: Fixed bug in the property so that no exception is raised when the spatial reference is undefined (Thanks Joe). git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@6916 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/gdal/layer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/django/contrib/gis/gdal/layer.py b/django/contrib/gis/gdal/layer.py index a3ef97e85e..d4d8e1b7c6 100644 --- a/django/contrib/gis/gdal/layer.py +++ b/django/contrib/gis/gdal/layer.py @@ -3,7 +3,7 @@ from ctypes import byref # Other GDAL imports. from django.contrib.gis.gdal.envelope import Envelope, OGREnvelope -from django.contrib.gis.gdal.error import OGRException, OGRIndexError +from django.contrib.gis.gdal.error import OGRException, OGRIndexError, SRSException from django.contrib.gis.gdal.feature import Feature from django.contrib.gis.gdal.geometries import OGRGeomType from django.contrib.gis.gdal.srs import SpatialReference @@ -99,10 +99,10 @@ class Layer(object): @property def srs(self): "Returns the Spatial Reference used in this Layer." - ptr = get_layer_srs(self._ptr) - if ptr: + try: + ptr = get_layer_srs(self._ptr) return SpatialReference(clone_srs(ptr)) - else: + except SRSException: return None @property