Loading django/contrib/gis/admin/widgets.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ from django.template import loader, Context from django.utils import six from django.utils import translation from django.contrib.gis.gdal import OGRException from django.contrib.gis.gdal import GDALException from django.contrib.gis.geos import GEOSGeometry, GEOSException # Creating a template context that contains Django settings Loading Loading @@ -68,7 +68,7 @@ class OpenLayersWidget(Textarea): ogr = value.ogr ogr.transform(srid) wkt = ogr.wkt except OGRException as err: except GDALException as err: logger.error( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( value.srid, srid, err) Loading django/contrib/gis/forms/widgets.py +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ class BaseGeometryWidget(Widget): ogr = value.ogr ogr.transform(self.map_srid) value = ogr except gdal.OGRException as err: except gdal.GDALException as err: logger.error( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( value.srid, self.map_srid, err) Loading django/contrib/gis/gdal/__init__.py +5 −4 Original line number Diff line number Diff line Loading @@ -31,12 +31,13 @@ to a non-existent file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`; setting to None/False/'' will not work as a string must be given). """ from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException # NOQA from django.contrib.gis.gdal.error import (check_err, GDALException, OGRException, OGRIndexError, SRSException) # NOQA from django.contrib.gis.gdal.geomtype import OGRGeomType # NOQA __all__ = [ 'check_err', 'OGRException', 'OGRIndexError', 'SRSException', 'OGRGeomType', 'HAS_GDAL', 'check_err', 'GDALException', 'OGRException', 'OGRIndexError', 'SRSException', 'OGRGeomType', 'HAS_GDAL', ] # Attempting to import objects that depend on the GDAL library. The Loading @@ -53,7 +54,7 @@ try: 'Driver', 'DataSource', 'gdal_version', 'gdal_full_version', 'GDAL_VERSION', 'SpatialReference', 'CoordTransform', 'OGRGeometry', ] except OGRException: except GDALException: HAS_GDAL = False try: Loading django/contrib/gis/gdal/datasource.py +5 −5 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ from ctypes import byref # The GDAL C library, OGR exceptions, and the Layer object. from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.error import OGRException, OGRIndexError from django.contrib.gis.gdal.error import GDALException, OGRIndexError from django.contrib.gis.gdal.layer import Layer # Getting the ctypes prototypes for the DataSource. Loading Loading @@ -75,21 +75,21 @@ class DataSource(GDALBase): try: # OGROpen will auto-detect the data source type. ds = capi.open_ds(force_bytes(ds_input), self._write, byref(ds_driver)) except OGRException: except GDALException: # Making the error message more clear rather than something # like "Invalid pointer returned from OGROpen". raise OGRException('Could not open the datasource at "%s"' % ds_input) raise GDALException('Could not open the datasource at "%s"' % ds_input) elif isinstance(ds_input, self.ptr_type) and isinstance(ds_driver, Driver.ptr_type): ds = ds_input else: raise OGRException('Invalid data source input type: %s' % type(ds_input)) raise GDALException('Invalid data source input type: %s' % type(ds_input)) if ds: self.ptr = ds self.driver = Driver(ds_driver) else: # Raise an exception if the returned pointer is NULL raise OGRException('Invalid data source file "%s"' % ds_input) raise GDALException('Invalid data source file "%s"' % ds_input) def __del__(self): "Destroys this DataStructure object." Loading django/contrib/gis/gdal/driver.py +3 −3 Original line number Diff line number Diff line from ctypes import c_void_p from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import OGRException from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi from django.utils import six Loading Loading @@ -61,11 +61,11 @@ class Driver(GDALBase): elif isinstance(dr_input, c_void_p): driver = dr_input else: raise OGRException('Unrecognized input type for GDAL/OGR Driver: %s' % str(type(dr_input))) raise GDALException('Unrecognized input type for GDAL/OGR Driver: %s' % str(type(dr_input))) # Making sure we get a valid pointer to the OGR Driver if not driver: raise OGRException('Could not initialize GDAL/OGR Driver on input: %s' % str(dr_input)) raise GDALException('Could not initialize GDAL/OGR Driver on input: %s' % str(dr_input)) self.ptr = driver def __str__(self): Loading Loading
django/contrib/gis/admin/widgets.py +2 −2 Original line number Diff line number Diff line Loading @@ -5,7 +5,7 @@ from django.template import loader, Context from django.utils import six from django.utils import translation from django.contrib.gis.gdal import OGRException from django.contrib.gis.gdal import GDALException from django.contrib.gis.geos import GEOSGeometry, GEOSException # Creating a template context that contains Django settings Loading Loading @@ -68,7 +68,7 @@ class OpenLayersWidget(Textarea): ogr = value.ogr ogr.transform(srid) wkt = ogr.wkt except OGRException as err: except GDALException as err: logger.error( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( value.srid, srid, err) Loading
django/contrib/gis/forms/widgets.py +1 −1 Original line number Diff line number Diff line Loading @@ -60,7 +60,7 @@ class BaseGeometryWidget(Widget): ogr = value.ogr ogr.transform(self.map_srid) value = ogr except gdal.OGRException as err: except gdal.GDALException as err: logger.error( "Error transforming geometry from srid '%s' to srid '%s' (%s)" % ( value.srid, self.map_srid, err) Loading
django/contrib/gis/gdal/__init__.py +5 −4 Original line number Diff line number Diff line Loading @@ -31,12 +31,13 @@ to a non-existent file location (e.g., `GDAL_LIBRARY_PATH='/null/path'`; setting to None/False/'' will not work as a string must be given). """ from django.contrib.gis.gdal.error import check_err, OGRException, OGRIndexError, SRSException # NOQA from django.contrib.gis.gdal.error import (check_err, GDALException, OGRException, OGRIndexError, SRSException) # NOQA from django.contrib.gis.gdal.geomtype import OGRGeomType # NOQA __all__ = [ 'check_err', 'OGRException', 'OGRIndexError', 'SRSException', 'OGRGeomType', 'HAS_GDAL', 'check_err', 'GDALException', 'OGRException', 'OGRIndexError', 'SRSException', 'OGRGeomType', 'HAS_GDAL', ] # Attempting to import objects that depend on the GDAL library. The Loading @@ -53,7 +54,7 @@ try: 'Driver', 'DataSource', 'gdal_version', 'gdal_full_version', 'GDAL_VERSION', 'SpatialReference', 'CoordTransform', 'OGRGeometry', ] except OGRException: except GDALException: HAS_GDAL = False try: Loading
django/contrib/gis/gdal/datasource.py +5 −5 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ from ctypes import byref # The GDAL C library, OGR exceptions, and the Layer object. from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.driver import Driver from django.contrib.gis.gdal.error import OGRException, OGRIndexError from django.contrib.gis.gdal.error import GDALException, OGRIndexError from django.contrib.gis.gdal.layer import Layer # Getting the ctypes prototypes for the DataSource. Loading Loading @@ -75,21 +75,21 @@ class DataSource(GDALBase): try: # OGROpen will auto-detect the data source type. ds = capi.open_ds(force_bytes(ds_input), self._write, byref(ds_driver)) except OGRException: except GDALException: # Making the error message more clear rather than something # like "Invalid pointer returned from OGROpen". raise OGRException('Could not open the datasource at "%s"' % ds_input) raise GDALException('Could not open the datasource at "%s"' % ds_input) elif isinstance(ds_input, self.ptr_type) and isinstance(ds_driver, Driver.ptr_type): ds = ds_input else: raise OGRException('Invalid data source input type: %s' % type(ds_input)) raise GDALException('Invalid data source input type: %s' % type(ds_input)) if ds: self.ptr = ds self.driver = Driver(ds_driver) else: # Raise an exception if the returned pointer is NULL raise OGRException('Invalid data source file "%s"' % ds_input) raise GDALException('Invalid data source file "%s"' % ds_input) def __del__(self): "Destroys this DataStructure object." Loading
django/contrib/gis/gdal/driver.py +3 −3 Original line number Diff line number Diff line from ctypes import c_void_p from django.contrib.gis.gdal.base import GDALBase from django.contrib.gis.gdal.error import OGRException from django.contrib.gis.gdal.error import GDALException from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi from django.utils import six Loading Loading @@ -61,11 +61,11 @@ class Driver(GDALBase): elif isinstance(dr_input, c_void_p): driver = dr_input else: raise OGRException('Unrecognized input type for GDAL/OGR Driver: %s' % str(type(dr_input))) raise GDALException('Unrecognized input type for GDAL/OGR Driver: %s' % str(type(dr_input))) # Making sure we get a valid pointer to the OGR Driver if not driver: raise OGRException('Could not initialize GDAL/OGR Driver on input: %s' % str(dr_input)) raise GDALException('Could not initialize GDAL/OGR Driver on input: %s' % str(dr_input)) self.ptr = driver def __str__(self): Loading