[Dive4elements-commits] [PATCH 09 of 15] (importer) Enable hws_* importers
Wald Commits
scm-commit at wald.intevation.org
Mon Jan 28 12:27:36 CET 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1359107239 -3600
# Node ID 63f82bdd45f84cbc0890977787e73dae91d1f7e5
# Parent 82d00b0c7302cbcc21998dd7ea0b941f2963941b
(importer) Enable hws_* importers
diff -r 82d00b0c7302 -r 63f82bdd45f8 flys-backend/contrib/shpimporter/shpimporter.py
--- a/flys-backend/contrib/shpimporter/shpimporter.py Fri Jan 25 10:46:00 2013 +0100
+++ b/flys-backend/contrib/shpimporter/shpimporter.py Fri Jan 25 10:47:19 2013 +0100
@@ -14,7 +14,7 @@
from crosssectiontracks import CrosssectionTrack
from floodplains import Floodplain
from boundaries import HydrBoundary, HydrBoundaryPoly
-from hws import HWS
+from hws import HWSLines, HWSPoints
from gauges import GaugeLocation
from catchments import Catchment
@@ -49,7 +49,8 @@
Floodplain(config, dbconn),
HydrBoundary(config, dbconn),
HydrBoundaryPoly(config, dbconn),
- HWS(config, dbconn),
+ HWSLines(config, dbconn),
+ HWSPoints(config, dbconn),
GaugeLocation(config, dbconn),
Catchment(config, dbconn),
UESG(config, dbconn)
@@ -74,7 +75,8 @@
parser.add_option("--skip_lines", type="int")
parser.add_option("--skip_fixpoints", type="int")
parser.add_option("--skip_floodplains", type="int")
- parser.add_option("--skip_hws", type="int")
+ parser.add_option("--skip_hws_lines", type="int")
+ parser.add_option("--skip_hws_points", type="int")
parser.add_option("--skip_gauge_locations", type="int")
parser.add_option("--skip_catchments", type="int")
parser.add_option("--skip_kms", type="int")
@@ -118,7 +120,9 @@
return True
elif config.skip_floodplains == 1 and isinstance(importer, Floodplain):
return True
- elif config.skip_hws == 1 and isinstance(importer, HWS):
+ elif config.skip_hws_points == 1 and isinstance(importer, HWSPoints):
+ return True
+ elif config.skip_hws_lines == 1 and isinstance(importer, HWSLines):
return True
elif config.skip_gauge_locations == 1 and isinstance(importer, GaugeLocation):
return True
@@ -147,12 +151,14 @@
INFO("You enable 'dry_run'. No database transaction will take place!")
if config.ogr_connection:
- dbconn = ogr.Open(config.ogr_connection)
+ connstr = config.ogr_connection
else:
- dbconn = ogr.Open('OCI:%s/%s@%s' % (config.user, config.password, config.host))
+ connstr = 'OCI:%s/%s@%s' % (config.user, config.password, config.host)
- if not dbconn:
- shpimporter.ERROR("Could not connect to database %s" % self.dbconn)
+ dbconn = ogr.Open(connstr)
+
+ if dbconn == None:
+ ERROR("Could not connect to database %s" % connstr)
return -1
importers = getImporters(config, dbconn)
More information about the Dive4elements-commits
mailing list