kotti.views.file

class kotti.views.file.UploadedFileResponse(data, request=None, disposition='attachment', cache_max_age=None, content_type=None, content_encoding=None)[source]

A Response object that can be used to serve an UploadedFile instance.

data is the UploadedFile file field value.

request must be a Pyramid request object. Note that a request must be passed if the response is meant to attempt to use the wsgi.file_wrapper feature of the web server that you’re using to serve your Pyramid application.

cache_max_age is the number of seconds that should be used to HTTP cache this response.

content_type is the content_type of the response.

content_encoding is the content_encoding of the response. It’s generally safe to leave this set to None if you’re serving a binary file. This argument will be ignored if you also leave content-type as None.

Code adapted from pyramid.response.FileResponse