Skip to content

Commit 33db2c4

Browse files
authored
Correct type hints for render_block_to_string (#58)
1 parent ae6890d commit 33db2c4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ Improvements
1313
set to the result of calling ``render_block_to_string()``. Contributed by
1414
`@gogognome <https://github.com/gogognome>`_. (`#60 <https://github.com/clokep/django-render-block/pull/60>`_)
1515

16+
Bugfixes
17+
--------
18+
19+
* Fix incorrect type hints. Contributed by `@ma11011s <https://github.com/ma11011s>`_. (`#58 <https://github.com/clokep/django-render-block/pull/58>`_)
20+
1621
Maintenance
1722
-----------
1823

render_block/base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import List, Optional, Tuple, Union
1+
from typing import Any, Mapping, Optional, Sequence, Union
22

33
from django.http import HttpRequest, HttpResponse
44
from django.template import Context, loader
@@ -18,9 +18,9 @@ class Jinja2Template: # type: ignore[no-redef]
1818

1919

2020
def render_block_to_string(
21-
template_name: Union[str, Tuple[str], List[str]],
21+
template_name: Union[str, Sequence[str]],
2222
block_name: str,
23-
context: Optional[Context] = None,
23+
context: Optional[Union[Context, Mapping[str, Any]]] = None,
2424
request: Optional[HttpRequest] = None,
2525
) -> str:
2626
"""
@@ -62,9 +62,9 @@ def render_block_to_string(
6262

6363
def render_block(
6464
request: HttpRequest,
65-
template_name: str,
65+
template_name: Union[str, Sequence[str]],
6666
block_name: str,
67-
context: Optional[Context] = None,
67+
context: Optional[Union[Context, Mapping[str, Any]]] = None,
6868
content_type: Optional[str] = None,
6969
status: Optional[int] = None,
7070
) -> HttpResponse:

0 commit comments

Comments
 (0)