Skip to content

Commit

Permalink
Assign default_html to None, return empty string if default_html is N…
Browse files Browse the repository at this point in the history
…one, get rid of hard failure
  • Loading branch information
katdom13 committed Jan 23, 2024
1 parent 829f7ac commit befce00
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pattern_library/monkey_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
def override_tag(
register: django.template.Library,
name: str,
default_html: typing.Optional[typing.Any] = UNSPECIFIED,
default_html: typing.Optional[typing.Any] = None,
):
"""
An utility that helps you override original tags for use in your pattern library.
Expand Down Expand Up @@ -95,14 +95,15 @@ def node_render(context):
Warning,
)
else:
raise TypeError(
warnings.warn(
'default_html argument to override_tag must be a string (line %s in "%s")'
% (trace.lineno, trace.filename)
)
default_html = None

# Render provided default;
# if no stub data supplied.
return default_html
return default_html or ""
else:
logger.warning(
'No default or stub data defined for the "%s" tag in the "%s" template',
Expand Down

0 comments on commit befce00

Please sign in to comment.