Skip to content

Commit

Permalink
minor code change for defensive style when zero Featuretypes in WFS (#…
Browse files Browse the repository at this point in the history
…321)

* minor code change for defensive style when zero featsure types in WFS

* fix flake8 errors after flake8 upgrade to 3.8.2

* pin flake8 and pylint to 3.8.2 and 2.5.2 for reproducable builds
  • Loading branch information
justb4 committed May 30, 2020
1 parent 6ff109b commit d8b3667
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion GeoHealthCheck/healthcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def db_commit():
try:
DB.session.commit()
except Exception as err:
LOGGER.warning("Cannot commit to database %s".format(err))
LOGGER.warning('Cannot commit to database {}'.format(err))
DB.session.rollback()
# finally:
# DB.session.close()
Expand Down
9 changes: 5 additions & 4 deletions GeoHealthCheck/plugins/probe/wfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ def expand_params(self, resource):
try:
wfs = self.get_metadata_cached(resource, version='1.1.0')
feature_types = wfs.contents
if not feature_types:
raise Exception('No Feature Types in WFS')

feature_type_names = list(feature_types.keys())
self.layer_count = len(feature_type_names)

Expand Down Expand Up @@ -176,10 +179,8 @@ def expand_params(self, resource):
# oper.formatOptions
# break

# Take random feature_type to determine generic attrs
for feature_type_name in feature_types:
feature_type_entry = feature_types[feature_type_name]
break
# Take first feature_type to determine generic attrs
feature_type_entry = feature_types[feature_type_names[0]]

# SRS
crs_list = feature_type_entry.crsOptions
Expand Down
6 changes: 3 additions & 3 deletions GeoHealthCheck/plugins/probe/wfs3.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ def wfs3_api_doc(wfs3):

api_url = None

for l in wfs3.links:
if l['rel'] == 'service-desc':
api_url = l['href']
for link in wfs3.links:
if link['rel'] == 'service-desc':
api_url = link['href']

if not api_url:
raise RuntimeError('Did not find service-desc link in landing page')
Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
flake8
flake8==3.8.2
Paver==1.3.4
pylint
pylint==2.5.2

0 comments on commit d8b3667

Please sign in to comment.