Skip to content

Handle missing optional Tags in OpenSearch descriptions - #1047

Open
shkyyy18 wants to merge 1 commit into
geopython:masterfrom
shkyyy18:fix/opensearch-optional-tags
Open

shkyyy18 wants to merge 1 commit into
geopython:masterfrom
shkyyy18:fix/opensearch-optional-tags

Conversation

@shkyyy18

@shkyyy18 shkyyy18 commented Oct 1, 2026

Copy link
Copy Markdown

Problem

OpenSearch(..., xml=...) raises AttributeError: 'NoneType' object has no attribute 'split' when the description document omits <Tags>. The OpenSearch 1.1 specification explicitly allows Tags to appear zero or one time:
https://github.com/dewitt/opensearch/blob/master/opensearch-1-1-draft-6.md#the-tags-element

An empty <Tags/> produces the same exception. As a result, an otherwise usable description cannot be loaded.

Fix

Normalize an absent Tags text value to an empty string before splitting, returning an empty list. Existing tag splitting is unchanged.

Add synthetic XML regression coverage through the public OpenSearch constructor for missing, empty, whitespace-only, and populated Tags. The tests also check that the short name and URL template remain available. They do not make network requests.

Validation

Python 3.12.10, Windows:

  • Before the fix: 2 failing, 2 passing regression cases (missing and empty Tags fail).
  • After the fix: 242 passed, 95 online tests deselected using the project's configured offline test invocation and its three doctest deselections. Socket access was also disabled before collection so service-reachability decorators could not make outbound requests.
  • python -m flake8 owslib/ tests/test_opensearch.py: passed.
  • git diff --check: passed.

I did not run online service tests or build the documentation.

AI assistance was used to investigate, implement, and test this change.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant