http_caching

Handles HTTP caching.

gratipay.utils.http_caching.concat_files(files, root)[source]

Concatenate a list of files.

Parameters:
  • files (list) – a list of relative file paths
  • root (string) – the root relative to which the files are
Returns:

the concatenated files as a string, with files demarcated by JavaScript block-style comments

gratipay.utils.http_caching.try_to_serve_304(dispatch_result, request, etag)[source]

Try to serve a 304 for static resources.

gratipay.utils.http_caching.add_caching_to_response(response, request=None, etag=None)[source]

Set caching headers.