Skip to content

Instantly share code, notes, and snippets.

@bmbouter
Created February 12, 2021 14:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmbouter/511118447fa78a5fc8d18f9831d117e6 to your computer and use it in GitHub Desktop.
Save bmbouter/511118447fa78a5fc8d18f9831d117e6 to your computer and use it in GitHub Desktop.
Testing to remove the db portion of the content app (originally from @dalley)
```diff
diff --git a/pulpcore/content/handler.py b/pulpcore/content/handler.py
index 6cdc51136..532316a64 100644
--- a/pulpcore/content/handler.py
+++ b/pulpcore/content/handler.py
@@ -58,6 +58,11 @@ class ArtifactNotFound(Exception):
pass
+CONTENT_ARTIFACT = ContentArtifact.objects.select_related("artifact").get(pk="b41e3214-fadb-46dc-b1d7-2ffe44699dbf")
+ARTIFACT_FILE = CONTENT_ARTIFACT.artifact.file
+ARTIFACT_NAME = ARTIFACT_FILE.name
+
+
class Handler:
"""
A default Handler for the Content App that also can be subclassed to create custom handlers.
@@ -344,6 +349,8 @@ class Handler:
:class:`aiohttp.web.StreamResponse` or :class:`aiohttp.web.FileResponse`: The response
streamed back to the client.
"""
+ return FileResponse(os.path.join(settings.MEDIA_ROOT, ARTIFACT_NAME))
+
distro = self._match_distribution(path)
self._permit(request, distro)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment