Skip to content

Commit

Permalink
Merge pull request #158 from wrabit/revert_isolated_context
Browse files Browse the repository at this point in the history
reverted isolated context
  • Loading branch information
wrabit authored Sep 20, 2024
2 parents 5eed005 + 6a69813 commit a89ef66
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
12 changes: 7 additions & 5 deletions django_cotton/templatetags/_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ def render(self, context):
}

template = self._get_cached_template(context, component_data["attrs"])
output = template.render(context.new(component_state))
cotton_data["stack"].pop()
# excludes builtin + custom context processors
# output = template.render(context.new(component_state))

# provides global
with context.push(component_state):
output = template.render(context)

# if not isolated, future 'only' support?:
# with context.push(component_state):
# output = template.render(context)
cotton_data["stack"].pop()

return output

Expand Down
4 changes: 3 additions & 1 deletion django_cotton/tests/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from unittest import skip

from django_cotton.tests.utils import CottonTestCase


Expand Down Expand Up @@ -103,12 +105,12 @@ def test_loader_scans_all_app_directories(self):
"""My template path was not specified in settings!""",
)

@skip("Not implemented")
def test_components_have_isolated_context(self):
self.create_template(
"cotton/isolated_context.html",
"""{{ outer }}""",
)

self.create_template(
"isolated_context_view.html",
"""
Expand Down

0 comments on commit a89ef66

Please sign in to comment.