diff flys-backend/contrib/shpimporter/shpimporter.py @ 4871:890eaa0a5162

Add ogr_connection parameter to allow directly setting the ogr connection. This allows the importer to connect with all supported and not just OCI
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 23 Jan 2013 11:51:14 +0100
parents 8654e4480fc6
children a563e9f58f93
line wrap: on
line diff
--- a/flys-backend/contrib/shpimporter/shpimporter.py	Mon Jan 28 00:46:46 2013 +0100
+++ b/flys-backend/contrib/shpimporter/shpimporter.py	Wed Jan 23 11:51:14 2013 +0100
@@ -63,6 +63,7 @@
     parser.add_option("--river_id", type="int")
     parser.add_option("--verbose", type="int", default=1)
     parser.add_option("--dry_run", type="int", default=0)
+    parser.add_option("--ogr_connection", type="string")
     parser.add_option("--skip_axis", type="int")
     parser.add_option("--skip_hydr_boundaries", type="int")
     parser.add_option("--skip_buildings", type="int")
@@ -80,16 +81,17 @@
     if config.directory == None:
         ERROR("No river directory specified!")
         raise Exception("Invalid config")
-    elif config.host == None:
-        ERROR("No database host specified!")
-        raise Exception("Invalid config")
-    elif config.user == None:
-        ERROR("No databaser user specified!")
-        raise Exception("Invalid config")
-    elif config.password == None:
-        ERROR("No password specified!")
-        raise Exception("Invalid config")
-    elif config.river_id == None:
+    if not config.ogr_connection:
+        if not config.host:
+            ERROR("No database host specified!")
+            raise Exception("Invalid config")
+        if not config.user:
+            ERROR("No databaser user specified!")
+            raise Exception("Invalid config")
+        if not config.password:
+            ERROR("No password specified!")
+            raise Exception("Invalid config")
+    if config.river_id == None:
         ERROR("No river id specified!")
         raise Exception("Invalid config")
 

http://dive4elements.wald.intevation.org