Utils

phased.utils.second_pass_render(request, content)

Split on the secret delimiter and generate the token list by passing through text outside of phased blocks as single text tokens and tokenizing text inside the phased blocks. This ensures that nothing outside of the phased blocks is tokenized, thus eliminating the possibility of a template code injection vulnerability.

phased.utils.drop_vary_headers(response, headers_to_drop)

Remove an item from the “Vary” header of an HttpResponse object. If no items remain, delete the “Vary” header. This does the opposite effect of django.utils.cache.patch_vary_headers.

phased.utils.flatten_context(context, remove_lazy=True)

Creates a dictionary from a Context instance by traversing its dicts list. Can remove unwanted subjects from the result, e.g. lazy objects.

phased.utils.unpickle_context(content, pattern=None)

Unpickle the context from the given content string or return None.

phased.utils.pickle_context(context, template=None)

Pickle the given Context instance and do a few optimzations before.

Project Versions

Previous topic

Template tag

Next topic

Changelog

This Page