diff --git a/pattern_library/monkey_utils.py b/pattern_library/monkey_utils.py index 956e638b..1859562f 100644 --- a/pattern_library/monkey_utils.py +++ b/pattern_library/monkey_utils.py @@ -7,7 +7,6 @@ from pattern_library.utils import is_pattern_library_context, render_pattern logger = logging.getLogger(__name__) -UNSPECIFIED = object() def override_tag( @@ -78,7 +77,7 @@ def node_render(context): # Render result instead of the tag, as a string. # See https://github.com/torchbox/django-pattern-library/issues/166. return str(result) - elif default_html is not UNSPECIFIED: + elif default_html is not None: # Render provided default; # if no stub data supplied. return default_html diff --git a/tests/templates/patterns/atoms/tags_test_atom/tags_test_atom.html b/tests/templates/patterns/atoms/tags_test_atom/tags_test_atom.html index c7945bc8..ce9895c1 100644 --- a/tests/templates/patterns/atoms/tags_test_atom/tags_test_atom.html +++ b/tests/templates/patterns/atoms/tags_test_atom/tags_test_atom.html @@ -4,10 +4,12 @@ SAND{% error_tag none %}WICH SAND{% error_tag zero %}WICH -POTA{% default_html_tag page.url %}TO +POTA{% default_html_tag page.url %}TO POTA{% default_html_tag page.child.url %}TO POTA{% default_html_tag None %}TO POTA{% default_html_tag_falsey empty_string %}TO1 POTA{% default_html_tag_falsey none %}TO2 -POTA{% default_html_tag_falsey zero %}TO3 \ No newline at end of file +POTA{% default_html_tag_falsey zero %}TO3 + +Real tag usage: {% pageurl page %} diff --git a/tests/tests/test_tags.py b/tests/tests/test_tags.py index ee88b900..37dabf44 100644 --- a/tests/tests/test_tags.py +++ b/tests/tests/test_tags.py @@ -4,6 +4,17 @@ class TagsTestCase(SimpleTestCase): + def test_real_tag_usage(self): + response = self.client.get( + reverse( + "pattern_library:render_pattern", + kwargs={ + "pattern_template_name": "patterns/atoms/tags_test_atom/tags_test_atom.html" + }, + ) + ) + self.assertContains(response, "Real tag usage: /page/url") + def test_falsey_raw_values_for_tag_output(self): response = self.client.get( reverse(