diff --git a/django_components/middleware.py b/django_components/middleware.py index 7ce173bf..e230983a 100644 --- a/django_components/middleware.py +++ b/django_components/middleware.py @@ -11,7 +11,9 @@ CSS_DEPENDENCY_PLACEHOLDER = '' JS_DEPENDENCY_PLACEHOLDER = '' SCRIPT_TAG_REGEX = re.compile("[\w\-/]+?) -->") +COMPONENT_COMMENT_REGEX = re.compile( + rb"" +) PLACEHOLDER_REGEX = re.compile( rb"" rb'|' diff --git a/tests/test_dependency_rendering.py b/tests/test_dependency_rendering.py index 41fa8fe9..5cce864b 100644 --- a/tests/test_dependency_rendering.py +++ b/tests/test_dependency_rendering.py @@ -399,8 +399,14 @@ class ComponentMediaRenderingTests(SimpleTestCase): request = Mock() self.assertEqual(response, middleware(request=request)) - def test_middleware_response_with_components_with_slash_dash_and_underscore(self): - component_names = ["test-component", "test/component", "test_component"] + def test_middleware_response_with_components_with_slash_dash_and_underscore( + self, + ): + component_names = [ + "test-component", + "test/component", + "test_component", + ] for component_name in component_names: component.registry.register( name=component_name, component=SimpleComponent @@ -412,8 +418,11 @@ class ComponentMediaRenderingTests(SimpleTestCase): f"{{% component '{component_name}' variable='value' %}}" ) rendered = create_and_process_template_response(template) - self.assertEqual(( - '' - '' - "Variable: value\n" - ), rendered) + self.assertEqual( + ( + '' + '' + "Variable: value\n" + ), + rendered, + )