Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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