Skip to content

Commit 4138261

Browse files
authored
Merge pull request #769 from CovingtonResearchGroup/master
changed all 'already exists' errors to warnings
2 parents b9cd08b + 5c67b73 commit 4138261

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

owslib/wmts.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,9 @@ def gather_layers(parent_elem, parent_metadata):
241241
parse_remote_metadata=parse_remote_metadata)
242242
if cm.id:
243243
if cm.id in self.contents:
244-
raise KeyError('Content metadata for layer "%s" '
244+
msg=('Content metadata for layer "%s" '
245245
'already exists' % cm.id)
246+
warnings.warn(msg, RuntimeWarning)
246247
self.contents[cm.id] = cm
247248
gather_layers(elem, cm)
248249
gather_layers(caps, None)
@@ -252,17 +253,19 @@ def gather_layers(parent_elem, parent_metadata):
252253
tms = TileMatrixSet(elem)
253254
if tms.identifier:
254255
if tms.identifier in self.tilematrixsets:
255-
raise KeyError('TileMatrixSet with identifier "%s" '
256+
msg = ('TileMatrixSet with identifier "%s" '
256257
'already exists' % tms.identifier)
258+
warnings.warn(msg, RuntimeWarning)
257259
self.tilematrixsets[tms.identifier] = tms
258260

259261
self.themes = {}
260262
for elem in self._capabilities.findall(_THEMES_TAG + '/' + _THEME_TAG):
261263
theme = Theme(elem)
262264
if theme.identifier:
263265
if theme.identifier in self.themes:
264-
raise KeyError('Theme with identifier "%s" already exists'
266+
msg=('Theme with identifier "%s" already exists'
265267
% theme.identifier)
268+
warnings.warn(msg, RuntimeWarning)
266269
self.themes[theme.identifier] = theme
267270

268271
serviceMetadataURL = self._capabilities.find(_SERVICE_METADATA_URL_TAG)
@@ -519,8 +522,9 @@ def __init__(self, elem):
519522
tm = TileMatrix(tilematrix)
520523
if tm.identifier:
521524
if tm.identifier in self.tilematrix:
522-
raise KeyError('TileMatrix with identifier "%s" '
525+
msg = ('TileMatrix with identifier "%s" '
523526
'already exists' % tm.identifier)
527+
warnings.warn(msg, RuntimeWarning)
524528
self.tilematrix[tm.identifier] = tm
525529

526530

@@ -748,9 +752,10 @@ def __init__(self, elem, parent=None, index=0, parse_remote_metadata=False):
748752
for tmsl in tile_matrix_set_links:
749753
if tmsl.tilematrixset:
750754
if tmsl.tilematrixset in self.tilematrixsetlinks:
751-
raise KeyError('TileMatrixSetLink with tilematrixset "%s"'
755+
msg = ('TileMatrixSetLink with tilematrixset "%s"'
752756
' already exists' %
753757
tmsl.tilematrixset)
758+
warnings.warn(msg, RuntimeWarning)
754759
self.tilematrixsetlinks[tmsl.tilematrixset] = tmsl
755760

756761
self.resourceURLs = []

0 commit comments

Comments
 (0)