Hi, I want to propose a backend refactor for feeds that keeps behavior the same but makes the code much easier to maintain.
Right now, too much feed logic is concentrated in one place and endpoint setup is repeated across views:
- Large multi-format response logic lives in
utils.py.
- Similar request setup is repeated in
feeds.py.
- Parameter handling, queryset construction, and output formatting are tightly coupled in
utils.py.
What I propose to implement:
- Keep the existing
feeds_response entrypoint, but split format-specific paths into internal handlers:
- json handler
- csv handler
- txt handler
- stix21 handler
- Extract shared feed setup flow used by feed endpoints so common logic is centralized (request params normalization, defaults/prioritization, queryset prep).
- Preserve current API contract and endpoint behavior, including pagination/auth/throttling behavior.
Target files:
utils.py
feeds.py
Validation:
- Ensure existing tests still pass, especially
test_feeds_view.py and test_feeds_advanced_view.py.
- Add focused regression tests for format parity and dispatcher behavior if needed.
This is not a feature rewrite and not an architecture change, just a behavior-preserving internal simplification to reduce future risk and improve maintainability
Hi, I want to propose a backend refactor for feeds that keeps behavior the same but makes the code much easier to maintain.
Right now, too much feed logic is concentrated in one place and endpoint setup is repeated across views:
utils.py.feeds.py.utils.py.What I propose to implement:
feeds_responseentrypoint, but split format-specific paths into internal handlers:Target files:
utils.pyfeeds.pyValidation:
test_feeds_view.pyandtest_feeds_advanced_view.py.This is not a feature rewrite and not an architecture change, just a behavior-preserving internal simplification to reduce future risk and improve maintainability