Skip to content

Commit

Permalink
resolves issue #916
Browse files Browse the repository at this point in the history
  • Loading branch information
pvgenuchten committed Apr 4, 2024
1 parent cdcfce7 commit 65433ed
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions owslib/catalogue/csw2.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,22 +172,25 @@ def getdomain(self, dname, dtype='parameter'):

self.request = node0

self._invoke()
try:
self._invoke()

if self.exceptionreport is None:
self.results = {}
if self.exceptionreport is None:
self.results = {}

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

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

# get the list of values associated with the Domain
self.results['values'] = []
# get the list of values associated with the Domain
self.results['values'] = []

for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)):
self.results['values'].append(util.testXMLValue(f))
for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)):
self.results['values'].append(util.testXMLValue(f))
except Exception:
self.results['values'] = []

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

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

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

0 comments on commit 65433ed

Please sign in to comment.