mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Update components.py
the contexts are mutable, therefore a MutableMapping makes more sense than a Mapping type
This commit is contained in:
parent
f01aaccb57
commit
92a3cc246e
@ -35,6 +35,7 @@ Changelog
|
||||
* Maintenance: Remove color tokens which are duplicates / unused (Thibaud Colas)
|
||||
* Maintenance: Add tests to help with maintenance of theme color tokens (Thibaud Colas)
|
||||
* Maintenance: Split out a base listing view from generic index view (Matt Westcott)
|
||||
* Maintenance: Update type hints in admin/ui/components.py so that `parent_context` is mutable (Andreas Nüßlein)
|
||||
|
||||
|
||||
5.0.2 (xx.xx.xxxx) - IN DEVELOPMENT
|
||||
|
@ -56,6 +56,7 @@ FieldPanels can now be marked as read-only with the `read_only=True` keyword arg
|
||||
* Remove color tokens which are duplicates / unused (Thibaud Colas)
|
||||
* Add tests to help with maintenance of theme color tokens (Thibaud Colas)
|
||||
* Split out a base listing view from generic index view (Matt Westcott)
|
||||
* Update type hints in admin/ui/components.py so that `parent_context` is mutable (Andreas Nüßlein)
|
||||
|
||||
|
||||
## Upgrade considerations
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import Any, Mapping
|
||||
from typing import Any, MutableMapping
|
||||
|
||||
from django.forms import MediaDefiningClass
|
||||
from django.template import Context
|
||||
@ -6,10 +6,12 @@ from django.template.loader import get_template
|
||||
|
||||
|
||||
class Component(metaclass=MediaDefiningClass):
|
||||
def get_context_data(self, parent_context: Mapping[str, Any]) -> Mapping[str, Any]:
|
||||
def get_context_data(
|
||||
self, parent_context: MutableMapping[str, Any]
|
||||
) -> MutableMapping[str, Any]:
|
||||
return {}
|
||||
|
||||
def render_html(self, parent_context: Mapping[str, Any] = None) -> str:
|
||||
def render_html(self, parent_context: MutableMapping[str, Any] = None) -> str:
|
||||
if parent_context is None:
|
||||
parent_context = Context()
|
||||
context_data = self.get_context_data(parent_context)
|
||||
|
Loading…
Reference in New Issue
Block a user