Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use flag instead of for-else in csw:retrecords #919

Merged
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
9 changes: 5 additions & 4 deletions owslib/catalogue/csw2.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ def getdomain(self, dname, dtype='parameter'):
# 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)):
for f in self._exml.findall(util.nspath_eval('csw:DomainValues/csw:ListOfValues/csw:Value', namespaces)): # noqa
self.results['values'].append(util.testXMLValue(f))
except Exception:
self.results['values'] = []
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 @@ -664,15 +664,16 @@ def _invoke(self):
post_verbs = [x for x in op.methods if x.get('type').lower() == 'post']
if len(post_verbs) > 1:
# Filter by constraints. We must match a PostEncoding of "XML"
found_xml = False
for pv in post_verbs:
for const in pv.get('constraints'):
if const.name.lower() == 'postencoding':
values = [v.lower() for v in const.values]
if 'xml' in values:
request_url = pv.get('url')
found_xml = True
break
else:
# Well, just use the first one.
if not found_xml: # Well, just use the first one.
request_url = post_verbs[0].get('url')
elif len(post_verbs) == 1:
request_url = post_verbs[0].get('url')
Expand Down
Loading