Commit Graph

5 Commits

Author SHA1 Message Date
Tim McCormack
7b1519f82e style: Fix some lint issues that had been amnestied
Several now-irrelevant lint-disables and one legit one that was easy to
fix.
2024-09-30 14:20:39 +00:00
Tim McCormack
660c30bb2b refactor: Fix content server methods and tests (finish method lift)
Some lingering cleanup from the transition from a middleware to a view.
See https://github.com/openedx/edx-platform/issues/34702 for context.

- Remove IMPL and self/StaticContentServer references
- Add newlines to satisfy code style linter
- Fix test references
- Update module docstring
2024-09-30 14:20:39 +00:00
Tim McCormack
8b162b4f36 refactor: Lift methods out of StaticContentServer (unchanged and broken)
Remove class declaration and simply de-indent contents by 4 spaces.

This results in broken code due to lingering `self` references, but
should make diffs easier to understand.
2024-09-30 14:19:49 +00:00
Tim McCormack
b615a8767f feat: Convert contentserver to view permanently (drop middleware and flag) (#35420)
Final planned portion of https://github.com/openedx/edx-platform/issues/34702 -- waffle flag and middleware are removed.

Commits:

1. Feature change
    - Delete `content_server.use_view` waffle flag in favor of always using view
    - Delete the husk of `StaticContentServerMiddleware` and references to it
    - Update views module docstring
2. Refactor (move)
    - Move contentserver implementation into views.py
3. Lint cleanup
    - Fix import ordering (from refactor debris + amnestied lint)
2024-09-06 14:42:32 +00:00
Tim McCormack
0eb61e28d1 feat: Start conversion of StaticContentServer from middleware into view (#34703)
See https://github.com/openedx/edx-platform/issues/34702

This necessarily involves switching from calling
`StaticContent.is_versioned_asset_path` to determine whether to handle the
request to having a hardcoded urlpattern. I've made the choice to hardcode
the other two patterns similarly rather than using imported constants. The
mapping of URL patterns to database records should be explicit (even though
we don't expect those constants to change out from under us.)

I've renamed the middleware rather than choosing a new name for the
implementation because there are other references in tests and other code.
This was the smaller change.

A note on HTTP methods: The middleware currently completely ignores the
request's HTTP method, so I wanted to confirm that only GETs were being
used in practice. This query reveals that 99.8% of requests that this
middleware handles are GET, with just a smattering of PROPFIND and OPTIONS
and a tiny number of HEAD and POST:
```
from Transaction select count(*) facet request.method
where name = 'WebTransaction/Function/openedx.core.djangoapps.contentserver.middleware:StaticContentServer'
since 4 weeks ago
```
2024-06-10 15:44:46 +00:00