file.filters
Attributes
Classes
| A depot filter that's only run if a condition is met. The condition | |
| A conditional filter that runs the passed filter only if the | |
| A conditional filter that runs the passed filter only if the | |
| Uploads a thumbnail together with the file. | |
| Uploads a preview thumbnail as PNG together with the file. | 
Module Contents
- class file.filters.ConditionalFilter(filter: depot.fields.interfaces.FileFilter)[source]
- Bases: - depot.fields.interfaces.FileFilter- A depot filter that’s only run if a condition is met. The condition is defined by overriding the :meth: - meets_conditionreturns True.
- class file.filters.OnlyIfImage(filter: depot.fields.interfaces.FileFilter)[source]
- Bases: - ConditionalFilter- A conditional filter that runs the passed filter only if the uploaded file is an image. 
- class file.filters.OnlyIfPDF(filter: depot.fields.interfaces.FileFilter)[source]
- Bases: - ConditionalFilter- A conditional filter that runs the passed filter only if the uploaded file is a pdf. 
- class file.filters.WithThumbnailFilter(name: str, size: tuple[int, int], format: str)[source]
- Bases: - depot.fields.interfaces.FileFilter- Uploads a thumbnail together with the file. - Takes for granted that the file is an image. - The resulting uploaded file will provide an additional property - thumbnail_name, which will contain the id and the path to the thumbnail. The name is replaced with the name given to the filter.- Warning - Requires Pillow library - Note: This has been copied from Depot and adjusted for our use. Changes include a different storage format, no storage of the url and replacement of thumbnails instead of recreation (if possible). 
- class file.filters.WithPDFThumbnailFilter(name: str, size: tuple[int, int], format: str)[source]
- Bases: - WithThumbnailFilter- Uploads a preview thumbnail as PNG together with the file. - This is basically the PDF implementation for WithThumbnailFilter. - Warning - Requires the presence of ghostscript (gs binary) on the PATH.