misc: set response.content as bytes, as appropriate (#67137)

This commit is contained in:
Frédéric Péters 2022-07-07 15:23:03 +02:00
parent d097bd581a
commit 0b470987ba
2 changed files with 3 additions and 3 deletions

View File

@ -364,8 +364,8 @@ 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 = b'{%% with page_template_name="%s" %%}%s{%% endwith %%}' % (
selected_page.template_name.encode(),
response.content,
)
response['X-Combo-Page-Id'] = str(selected_page.id)

View File

@ -341,7 +341,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" %}')
assert resp.text.startswith('{% with page_template_name="standard" %}<!DOCTYPE html>\n')
# url netloc match
resp = app.get('/__skeleton__/?source=%s' % quote('http://example.net'))