Added template_debug setting, closes #654

This commit is contained in:
Simon Willison 2019-12-22 16:04:45 +00:00
commit d54318fc7f
6 changed files with 61 additions and 23 deletions

View file

@ -1287,6 +1287,7 @@ def test_config_json(app_client):
"truncate_cells_html": 2048,
"force_https_urls": False,
"hash_urls": False,
"template_debug": False,
} == response.json

View file

@ -1073,3 +1073,16 @@ def test_zero_results(app_client, path):
soup = Soup(response.text, "html.parser")
assert 0 == len(soup.select("table"))
assert 1 == len(soup.select("p.zero-results"))
def test_config_template_debug_on():
for client in make_app_client(config={"template_debug": True}):
response = client.get("/fixtures/facetable?_context=1")
assert response.status == 200
assert response.text.startswith("<pre>{")
def test_config_template_debug_off(app_client):
response = app_client.get("/fixtures/facetable?_context=1")
assert response.status == 200
assert not response.text.startswith("<pre>{")