Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow mutable
extra_context
on TemplateView
s
Prior to this change, the `extra_context` attribute of a template view was annotated as a `dict` (or `None`). This means that if a value is provided, it *must* be a mutable object. Since this is an attribute on the class, this creates mutable shared state, which is a source of bugs. It was not possible to use an immutable mapping (`MappingProxyType or the 3rd-party `frozendict`) without getting type-checking errors. However, there is no need for this attribute to be mutable. This change allows *any* mapping type, which allows authors to write template views with immutable `extra_context` attributes. Refs #1992
- Loading branch information