django_sendfile.backends.simple module

django_sendfile.backends.simple.sendfile(request, filepath, **kwargs)[source]

Use the SENDFILE_ROOT value composed with the path arrived as argument to build an absolute path with which resolve and return the file contents.

If the path points to a file out of the root directory (should cover both situations with ‘..’ and symlinks) then a 404 is raised.

django_sendfile.backends.simple.was_modified_since(header=None, mtime=0, size=0)[source]

Was something modified since the user last downloaded it?

header

This is the value of the If-Modified-Since header. If this is None, I’ll just return True.

mtime

This is the modification time of the item we’re talking about.

size

This is the size of the item we’re talking about.