Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/django_nh3/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def normalize_nh3_options( # noqa: C901, PLR0912
elif kwarg_name == "strip_comments":
value = bool(value)

elif kwarg_name == "link_rel":
elif kwarg_name == "link_rel" and value is not None:
value = str(value)

elif kwarg_name == "tag_attribute_values":
Expand Down Expand Up @@ -149,7 +149,7 @@ def get_nh3_options(
attributes: dict[str, set[str]] | None = None,
attribute_filter: Callable[[str, str, str], str] | None = None,
strip_comments: bool = False,
link_rel: str = "",
link_rel: str | None = None,
generic_attribute_prefixes: set[str] | None = None,
tag_attribute_values: dict[str, dict[str, set[str]]] | None = None,
set_tag_attribute_values: dict[str, dict[str, str]] | None = None,
Expand All @@ -164,7 +164,7 @@ def get_nh3_options(
)
attribute_filter = attribute_filter or defaults.get("attribute_filter", None)
strip_comments = strip_comments or defaults.get("strip_comments", False)
link_rel = link_rel or defaults.get("link_rel", "")
link_rel = link_rel or defaults.get("link_rel", None)
generic_attribute_prefixes = (
generic_attribute_prefixes
or defaults.get("generic_attribute_prefixes", None)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def test_link_rel(self):
),
(
{"link_rel": None},
{"link_rel": "None"},
{"link_rel": None},
),
(
{"link_rel": True},
Expand Down