Skip to content

Commit 2f00ab8

Browse files
authored
resolves issue #916 (#918)
1 parent cdcfce7 commit 2f00ab8

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

owslib/catalogue/csw2.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -172,22 +172,25 @@ def getdomain(self, dname, dtype='parameter'):
172172

173173
self.request = node0
174174

175-
self._invoke()
175+
try:
176+
self._invoke()
176177

177-
if self.exceptionreport is None:
178-
self.results = {}
178+
if self.exceptionreport is None:
179+
self.results = {}
179180

180-
val = self._exml.find(util.nspath_eval('csw:DomainValues', namespaces)).attrib.get('type')
181-
self.results['type'] = util.testXMLValue(val, True)
181+
val = self._exml.find(util.nspath_eval('csw:DomainValues', namespaces)).attrib.get('type')
182+
self.results['type'] = util.testXMLValue(val, True)
182183

183-
val = self._exml.find(util.nspath_eval('csw:DomainValues/csw:%s' % dtypename, namespaces))
184-
self.results[dtype] = util.testXMLValue(val)
184+
val = self._exml.find(util.nspath_eval('csw:DomainValues/csw:%s' % dtypename, namespaces))
185+
self.results[dtype] = util.testXMLValue(val)
185186

186-
# get the list of values associated with the Domain
187-
self.results['values'] = []
187+
# get the list of values associated with the Domain
188+
self.results['values'] = []
188189

189-
for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)):
190-
self.results['values'].append(util.testXMLValue(f))
190+
for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)):
191+
self.results['values'].append(util.testXMLValue(f))
192+
except Exception:
193+
self.results['values'] = []
191194

192195
def getrecords(self, qtype=None, keywords=[], typenames='csw:Record', propertyname='csw:AnyText', bbox=None,
193196
esn='summary', sortby=None, outputschema=namespaces['csw'], format=outputformat, startposition=0,
@@ -715,7 +718,7 @@ def _invoke(self):
715718
]
716719

717720
if self._exml.getroot().tag not in valid_xpaths:
718-
raise RuntimeError('Document is XML, but not CSW-ish')
721+
raise RuntimeError(f'Document is XML, but not CSW-ish, {request_url}?{self.request}')
719722

720723
# check if it's an OGC Exception
721724
val = self._exml.find(util.nspath_eval('ows:Exception', namespaces))

0 commit comments

Comments
 (0)