From f04b5b2e4d390b5642cbe2d4e716771cc88aff26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 21 Nov 2018 16:02:18 +0100 Subject: [PATCH] misc: put page template name in exported skeleton context (#28225) --- combo/public/views.py | 3 +++ tests/test_public.py | 1 + 2 files changed, 4 insertions(+) diff --git a/combo/public/views.py b/combo/public/views.py index b908403a..6fa07949 100644 --- a/combo/public/views.py +++ b/combo/public/views.py @@ -284,6 +284,9 @@ def skeleton(request): template_name = combo_template['template'] response = render(request, template_name, ctx) + response.content = '{%% with page_template_name="%s" %%}%s{%% endwith %%}' % ( + str(selected_page.template_name), + response.content) response['X-Combo-Page-Id'] = str(selected_page.id) response['X-Combo-Skeleton-Pages'] = json.dumps( dict([(x.id, utils.get_templated_url(x.redirect_url)) for x in same_domain_pages])) diff --git a/tests/test_public.py b/tests/test_public.py index 47942fd8..6fde354d 100644 --- a/tests/test_public.py +++ b/tests/test_public.py @@ -221,6 +221,7 @@ def test_page_skeleton(app): resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net/foo/bar')) assert '{% block placeholder-content %}{% block content %}{% endblock %}{% endblock %}' in resp.text assert '{% block placeholder-footer %}{% block footer %}{% endblock %}{% endblock %}' in resp.text + assert resp.text.startswith('{% with page_template_name="standard" %}') # url netloc match resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net')) -- 2.19.1