changeset 4878:82d00b0c7302

(importer) Avoid uneccessary error and improve debug output
author Andre Heinecke <aheinecke@intevation.de>
date Fri, 25 Jan 2013 10:46:00 +0100
parents 852d4c508f33
children 63f82bdd45f8
files flys-backend/contrib/shpimporter/importer.py
diffstat 1 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/importer.py	Fri Jan 25 10:44:58 2013 +0100
+++ b/flys-backend/contrib/shpimporter/importer.py	Fri Jan 25 10:46:00 2013 +0100
@@ -28,12 +28,9 @@
         raise NotImplementedError("Importer.getTablename is abstract!")
 
     def IsFieldSet(self, feat, name):
-        try:
-            isset = feat.GetField(name)
-            return isset is not None
-        except:
-            return False
-
+        if feat.GetFieldIndex(name) == -1:
+            return False # Avoids an Error in IsFieldSet
+        return feat.IsFieldSet(feat.GetFieldIndex(name))
 
     def IsDoubleFieldSet(self, feat, name):
         try:
@@ -104,6 +101,7 @@
             geom     = feat.GetGeometryRef()
 
             if geom is None:
+                shpimporter.DEBUG("Unkown Geometry reference for feature")
                 continue
 
             geomType = geom.GetGeometryType()

http://dive4elements.wald.intevation.org