Skip to content

Commit befce00

Browse files
committed
Assign default_html to None, return empty string if default_html is None, get rid of hard failure
1 parent 829f7ac commit befce00

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pattern_library/monkey_utils.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
def override_tag(
1616
register: django.template.Library,
1717
name: str,
18-
default_html: typing.Optional[typing.Any] = UNSPECIFIED,
18+
default_html: typing.Optional[typing.Any] = None,
1919
):
2020
"""
2121
An utility that helps you override original tags for use in your pattern library.
@@ -95,14 +95,15 @@ def node_render(context):
9595
Warning,
9696
)
9797
else:
98-
raise TypeError(
98+
warnings.warn(
9999
'default_html argument to override_tag must be a string (line %s in "%s")'
100100
% (trace.lineno, trace.filename)
101101
)
102+
default_html = None
102103

103104
# Render provided default;
104105
# if no stub data supplied.
105-
return default_html
106+
return default_html or ""
106107
else:
107108
logger.warning(
108109
'No default or stub data defined for the "%s" tag in the "%s" template',

0 commit comments

Comments
 (0)