From 402552e0e718c2a3f169738c116ca1f7d22feab7 Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Thu, 4 Apr 2024 21:34:12 +0200 Subject: [PATCH] for-else works on inner loop only --- owslib/catalogue/csw2.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/owslib/catalogue/csw2.py b/owslib/catalogue/csw2.py index 193d831e..a5c86130 100644 --- a/owslib/catalogue/csw2.py +++ b/owslib/catalogue/csw2.py @@ -661,15 +661,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" + foundXML = 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') + foundXML = True break - else: - # Well, just use the first one. + if not foundXML: # 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')