calingen.contrib.compilers.download.compiler¶
The actual implementation of the compiler.
Module Contents¶
Classes¶
Do not compile sources, but provide them as file download. |
Attributes¶
A |
- class calingen.contrib.compilers.download.compiler.DownloadCompiler¶
Bases:
calingen.interfaces.plugin_api.CompilerProviderDo not compile sources, but provide them as file download.
- title = DownloadCompiler¶
- classmethod get_response(source, layout_type=None)¶
Get the compiler’s HTTP response.
This is the compiler’s main interface to other components of the app.
It should be used to actually trigger the compilation of the provided source and then return a valid Django Response object.
- Parameters:
source (str) – The source as provided by
LayoutProvider.render().- Return type:
Notes
This method is called from
CompilerView's get() methodwith an additional keyword argumentlayout_type, exposing thelayout_typeattribute of the layout.
- calingen.contrib.compilers.download.compiler.SOURCE_TYPE_LOOKUP¶
A
dictthat provides meta information for file downloads.The
get_response()uses thisdictto determine the file extension and MIME type for the download, based on the layout’slayout_typeattribute (seecalingen.interfaces.plugin_api.LayoutProvider).