as a plugin writer, my custom content handler can handle requests for CONTENT_PATH_PREFIX
Plugins that need to have some custom logic for serving content can provide a custom content Handler. Up till now, each plugin that needed a custom handler, did so because it needed to provide an API that was rooted somewhere other than CONTENT_PATH_PREFIX.
The RPM plugin wants to provide a repo.config file that is dynamically generated based on the distribution's 'base_path' and 'base_url' . It does not need to serve an API rooted at a different path.
- Add a hook method to BaseDistribution named content_handler() which would provide a no-op as it's base functionality and return None by default. It would take subpath as the single param and that would be the url portion after the distribution's base_path (the remaining part).
- In the content app just after the Distribution is matched and permit() is called we have the content app call this new
content_handler. That would roughly be here.
- If the
content_handler(subpath)returns a subclass of aiohttp.web.Response(...) then return that and don't continue to call the rest of the code in the content app.
Implement content_handler for BaseDistribution
This allows Plugin writers to serve non-Artifact content.
Add content_handler_directory_listing in Dist
This allows plugin writers to add files served by content_handler to show up in the directory listings.
Please register to edit this issue