Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Convert contentserver to view permanently (drop middleware and flag) #35420

Merged
merged 4 commits into from
Sep 6, 2024

Conversation

timmc-edx
Copy link
Contributor

@timmc-edx timmc-edx commented Sep 3, 2024

Final planned portion of #34702 -- waffle flag and middleware are removed.

This is best reviewed commit by commit:

  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)

…flag)

- 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.

This is the first commit of a change/refactor series.
Minimal adjustment of affected import paths, no lint cleanup.

This is the second commit in a refactor/change series.
- Remove `wrong-import-order` amnesty comments
- Run `isort` on the directory

This is the third and last commit in a refactor/change series.
@timmc-edx timmc-edx changed the title Timmc/asset view only feat: Convert contentserver to view permanently (drop middleware and flag) Sep 3, 2024
return HttpResponseNotFound()
else:
return response
return IMPL.process_request(request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I hate the name IMPL. I prefer something like STATIC_CONTENT_SERVER_INSTANCE, or better yet, just replace it with StaticContentServer(), assuming that instantiation is negligible.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, no argument there! But I think the next step is to actually just get rid of StaticContentServer entirely, as it's a class with no state and all the methods are just helper functions that could be dumped into the module, top-level.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. The only difference is that the former could have been done in 1 minute, and the latter may never actually happen (unless you are planning more clean-up). Oh well. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, it could have been done in 25 minutes, because of the length of time it takes to re-run tests on edx-platform. :-P Sorry, I just really didn't want to do another cycle of that. I do have more cleanup, planned, though -- this was intended as a minimum possible refactor to get rid of the middleware.

@timmc-edx timmc-edx merged commit b615a87 into master Sep 6, 2024
49 checks passed
@timmc-edx timmc-edx deleted the timmc/asset-view-only branch September 6, 2024 14:42
MueezKhan246 pushed a commit that referenced this pull request Sep 6, 2024
…flag) (#35420)

Final planned portion of #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)
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

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.

3 participants