Fix Django STAC search query parameter handling - #2412
Conversation
|
Moved the parametrized Django STAC regression to tests/other/test_django.py as requested, with a dedicated STAC API fixture so the existing Django tests keep their configuration. Removed the Django-specific imports from tests/api/test_stac.py. Validation: both complete test modules pass (10 tests), plus flake8 and git diff --check. The run reports dependency deprecation/NumPy binary-size/PROJ warnings; no test failures. The API implementation is unchanged in this update. Prepared with Codex assistance. |
I've added back in the (removed) text that is included as part of the PR template. Please complete/check off the items on Dependency Policy (RFC2), Updates to public demo, and Contributions and licensing. Thanks. |
|
The requested checklist is now completed in the PR description. No dependencies are changed and no demo configuration update is needed. I have personally completed the contributions and licensing checkboxes. |
Overview
Fixes #2411.
Django's
QueryDictstores lists internally, sodict(request.params)turns scalar query values into lists. This breaks STAC GET pagination (for examplelimit=10) and POST searches that retain query parameters.Copy the mapping's
items()instead, preserving each framework's scalar lookup semantics. Apply this to both POST overrides and pagination, using the publicparamsproperty. The regression cases use a real DjangoQueryDictthroughAPIRequest.from_djangoand cover repeated limit parameters, POST limit precedence, bbox retention, previous/next links, and preservation of the original query mapping.Related issue / discussion
#2411. No dependency or public API changes.
Validation
Windows, Python 3.13:
python -m pytest tests/api/test_stac.py -q: 8 passed. After moving the Django regressions as requested,python -m pytest tests/api/test_stac.py tests/other/test_django.py -q: 10 passed, with dependency warnings; changed-file flake8 and whitespace checks pass.python -m flake8: passed across the repository.tests/api/test_stac.py tests/api/test_api.py tests/api/test_itemtypes.py: 42 passed, 6 failed. All six existing failures reproduce on unchanged upstream:test_apirules_active,test_apirules_inactive,test_api_exception,test_describe_collections,test_describe_collections_enclosures, andtest_get_collection_item. With the two new regression cases included, upstream has 40 passed and 8 failed.Additional information
Prepared and tested with OpenAI Codex assistance.
Additional information
Dependency policy (RFC2)
No dependencies are added, removed, or changed. Django remains in the existing Django requirements, and the regression now resides in the Django-specific test module.
Updates to public demo
No public API, configuration, or deployment changes are introduced; there is no breaking demo change to address. The public demo was not redeployed as part of this fix.
Contributions and licensing
(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)