Loading django/contrib/gis/gdal/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ try: from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform from django.contrib.gis.gdal.geometries import OGRGeometry HAS_GDAL = True except: except ImportError: HAS_GDAL = False try: Loading django/contrib/gis/gdal/datasource.py +3 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ from django.contrib.gis.gdal.layer import Layer # Getting the ctypes prototypes for the DataSource. from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_bytes from django.utils import six from django.utils.six.moves import xrange Loading Loading @@ -73,7 +74,7 @@ class DataSource(GDALBase): ds_driver = Driver.ptr_type() try: # OGROpen will auto-detect the data source type. ds = capi.open_ds(ds_input, self._write, byref(ds_driver)) ds = capi.open_ds(force_bytes(ds_input), self._write, byref(ds_driver)) except OGRException: # Making the error message more clear rather than something # like "Invalid pointer returned from OGROpen". Loading Loading @@ -102,7 +103,7 @@ class DataSource(GDALBase): def __getitem__(self, index): "Allows use of the index [] operator to get a layer at the index." if isinstance(index, six.string_types): l = capi.get_layer_by_name(self.ptr, index) l = capi.get_layer_by_name(self.ptr, force_bytes(index)) if not l: raise OGRIndexError('invalid OGR Layer name given: "%s"' % index) elif isinstance(index, int): if index < 0 or index >= self.layer_count: Loading django/contrib/gis/gdal/driver.py +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ from django.contrib.gis.gdal.error import OGRException from django.contrib.gis.gdal.prototypes import ds as capi from django.utils import six from django.utils.encoding import force_bytes # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html Loading Loading @@ -36,7 +37,7 @@ class Driver(GDALBase): name = dr_input # Attempting to get the OGR driver by the string name. dr = capi.get_driver_by_name(name) dr = capi.get_driver_by_name(force_bytes(name)) elif isinstance(dr_input, int): self._register() dr = capi.get_driver(dr_input) Loading django/contrib/gis/gdal/envelope.py +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class Envelope(object): elif len(args) == 4: # Individual parameters passed in. # Thanks to ww for the help self._from_sequence(map(float, args)) self._from_sequence([float(a) for a in args]) else: raise OGRException('Incorrect number (%d) of arguments.' % len(args)) Loading django/contrib/gis/gdal/feature.py +4 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType # ctypes function prototypes from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api from django.utils.encoding import force_bytes from django.utils import six from django.utils.six.moves import xrange Loading Loading @@ -107,6 +108,7 @@ class Feature(GDALBase): def index(self, field_name): "Returns the index of the given field name." i = capi.get_field_index(self.ptr, field_name) if i < 0: raise OGRIndexError('invalid OFT field name given: "%s"' % field_name) i = capi.get_field_index(self.ptr, force_bytes(field_name)) if i < 0: raise OGRIndexError('invalid OFT field name given: "%s"' % field_name) return i Loading
django/contrib/gis/gdal/__init__.py +1 −1 Original line number Diff line number Diff line Loading @@ -41,7 +41,7 @@ try: from django.contrib.gis.gdal.srs import SpatialReference, CoordTransform from django.contrib.gis.gdal.geometries import OGRGeometry HAS_GDAL = True except: except ImportError: HAS_GDAL = False try: Loading
django/contrib/gis/gdal/datasource.py +3 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ from django.contrib.gis.gdal.layer import Layer # Getting the ctypes prototypes for the DataSource. from django.contrib.gis.gdal.prototypes import ds as capi from django.utils.encoding import force_bytes from django.utils import six from django.utils.six.moves import xrange Loading Loading @@ -73,7 +74,7 @@ class DataSource(GDALBase): ds_driver = Driver.ptr_type() try: # OGROpen will auto-detect the data source type. ds = capi.open_ds(ds_input, self._write, byref(ds_driver)) ds = capi.open_ds(force_bytes(ds_input), self._write, byref(ds_driver)) except OGRException: # Making the error message more clear rather than something # like "Invalid pointer returned from OGROpen". Loading Loading @@ -102,7 +103,7 @@ class DataSource(GDALBase): def __getitem__(self, index): "Allows use of the index [] operator to get a layer at the index." if isinstance(index, six.string_types): l = capi.get_layer_by_name(self.ptr, index) l = capi.get_layer_by_name(self.ptr, force_bytes(index)) if not l: raise OGRIndexError('invalid OGR Layer name given: "%s"' % index) elif isinstance(index, int): if index < 0 or index >= self.layer_count: Loading
django/contrib/gis/gdal/driver.py +2 −1 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ from django.contrib.gis.gdal.error import OGRException from django.contrib.gis.gdal.prototypes import ds as capi from django.utils import six from django.utils.encoding import force_bytes # For more information, see the OGR C API source code: # http://www.gdal.org/ogr/ogr__api_8h.html Loading Loading @@ -36,7 +37,7 @@ class Driver(GDALBase): name = dr_input # Attempting to get the OGR driver by the string name. dr = capi.get_driver_by_name(name) dr = capi.get_driver_by_name(force_bytes(name)) elif isinstance(dr_input, int): self._register() dr = capi.get_driver(dr_input) Loading
django/contrib/gis/gdal/envelope.py +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ class Envelope(object): elif len(args) == 4: # Individual parameters passed in. # Thanks to ww for the help self._from_sequence(map(float, args)) self._from_sequence([float(a) for a in args]) else: raise OGRException('Incorrect number (%d) of arguments.' % len(args)) Loading
django/contrib/gis/gdal/feature.py +4 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType # ctypes function prototypes from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api from django.utils.encoding import force_bytes from django.utils import six from django.utils.six.moves import xrange Loading Loading @@ -107,6 +108,7 @@ class Feature(GDALBase): def index(self, field_name): "Returns the index of the given field name." i = capi.get_field_index(self.ptr, field_name) if i < 0: raise OGRIndexError('invalid OFT field name given: "%s"' % field_name) i = capi.get_field_index(self.ptr, force_bytes(field_name)) if i < 0: raise OGRIndexError('invalid OFT field name given: "%s"' % field_name) return i