From 298074d5b86e6669b9e43abc77c26ee5be21ead2 Mon Sep 17 00:00:00 2001 From: Justin Bronn Date: Sun, 6 Jan 2008 22:20:39 +0000 Subject: [PATCH] gis: gdal: Fixed Driver and DataSource bug reported by David Hancock in django-users and reproduced by tlp. git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@7003 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/gis/gdal/datasource.py | 3 +-- django/contrib/gis/gdal/driver.py | 5 ++--- django/contrib/gis/gdal/prototypes/generation.py | 3 +++ 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/django/contrib/gis/gdal/datasource.py b/django/contrib/gis/gdal/datasource.py index f2b519afc7..0cc757d7a5 100644 --- a/django/contrib/gis/gdal/datasource.py +++ b/django/contrib/gis/gdal/datasource.py @@ -67,8 +67,7 @@ class DataSource(object): # Registering all the drivers, this needs to be done # _before_ we try to open up a data source. - if not get_driver_count() and not register_all(): - raise OGRException('Could not register all the OGR data source drivers!') + if not get_driver_count(): register_all() if isinstance(ds_input, basestring): # The data source driver is a void pointer. diff --git a/django/contrib/gis/gdal/driver.py b/django/contrib/gis/gdal/driver.py index bfb87fa9f6..2d5b3df807 100644 --- a/django/contrib/gis/gdal/driver.py +++ b/django/contrib/gis/gdal/driver.py @@ -56,9 +56,8 @@ class Driver(object): def _register(self): "Attempts to register all the data source drivers." # Only register all if the driver count is 0 (or else all drivers - # will be registered over and over again) - if not self.driver_count and not register_all(): - raise OGRException('Could not register all the OGR data source drivers!') + # will be registered over and over again) + if not self.driver_count: register_all() # Driver properties @property diff --git a/django/contrib/gis/gdal/prototypes/generation.py b/django/contrib/gis/gdal/prototypes/generation.py index 485cc29245..bba715d67c 100644 --- a/django/contrib/gis/gdal/prototypes/generation.py +++ b/django/contrib/gis/gdal/prototypes/generation.py @@ -103,6 +103,9 @@ def void_output(func, argtypes, errcheck=True): # return void, rather than a status code. func.restype = c_int func.errcheck = check_errcode + else: + func.restype = None + return func def voidptr_output(func, argtypes):