[Dive4elements-commits] [PATCH 08 of 15] (importer) Avoid uneccessary error and improve debug output

Wald Commits scm-commit at wald.intevation.org
Mon Jan 28 12:27:35 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1359107160 -3600
# Node ID 82d00b0c7302cbcc21998dd7ea0b941f2963941b
# Parent  852d4c508f33c3dcbb0977e6b43ff648c0341761
(importer) Avoid uneccessary error and improve debug output

diff -r 852d4c508f33 -r 82d00b0c7302 flys-backend/contrib/shpimporter/importer.py
--- 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()


More information about the Dive4elements-commits mailing list