oioioi.filetracker.utils
¶
Module Contents¶
Classes¶
A stub |
Functions¶
|
Returns the filetracker path of a |
|
Returns a |
|
Returns a Content-Disposition header field per RFC 6266 |
|
Returns a |
- class oioioi.filetracker.utils.FileInFiletracker(storage, name)[source]¶
Bases:
django.core.files.File
A stub
django.core.files.File
subclass for assigning existing Filetracker files to :class:`django.db.models.FileField`s.Usage:
some_model_instance.file_field = filetracker_to_django_file('some/path')
- oioioi.filetracker.utils.django_to_filetracker_path(django_file)[source]¶
Returns the filetracker path of a
django.core.files.File
.
- oioioi.filetracker.utils.filetracker_to_django_file(filetracker_path, storage=None)[source]¶
Returns a
File
representing an existing Filetracker file (usable only for assigning to aFileField
)
- oioioi.filetracker.utils.make_content_disposition_header(disposition, filename)[source]¶
Returns a Content-Disposition header field per RFC 6266 as a bytestring.
The
disposition
argument should be eitherinline
orattachment
and the filename should be a unicode object, which need not be sanitized.
- oioioi.filetracker.utils.stream_file(django_file, name=None, showable=None)[source]¶
Returns a
HttpResponse
representing a file download.Optional argument
name
sets default filename under which user is prompted to save thatdjango_file
.Some types of files, as listed below in
showable_exts
variable, may by default be displayed in browser. Other are forced to be downloaded. Usingshowable
flag, default behaviour may be overriden in both directions.