logo
Expand description

This module implements various helpers.

Traits

Path bound trait.

Functions

One helper function that can be used to return HTTP Error inside a view function.

Replace special characters “&”, “<”, “>” and (“) to HTML-safe characters.

Returns a response that redirects the client to the target location.

Safely join directory and filename, otherwise this returns None.

Sends the contents of a file to the client. Please never pass filenames to this function from user sources without checking them first. Set as_attachment to true if you want to send this file with a Content-Disposition: attachment header. This will return NotFound if filepath is not one file.

Sends the contents of a file to the client, supporting HTTP Range requests, so it allows only partial files to be requested and sent. This doesn’t support multiranges at the moment. Please never pass filenames to this function from user sources without checking them first. Set as_attachment to true if you want to send this file with a Content-Disposition: attachment header. This will return NotFound if filepath is not one file.

Send a file from a given directory with send_file. This is a secure way to quickly expose static files from an folder. This will guess the mimetype for you.

Send a file from a given directory with send_file, supporting HTTP Range requests, so it allows only partial files to be requested and sent. This doesn’t support multiranges at the moment. This is a secure way to quickly expose static files from an folder. This will guess the mimetype for you.