From e077224f4ad69a68ae58a373ef69941272d3656c Mon Sep 17 00:00:00 2001 From: Bouke Haarsma Date: Mon, 14 Oct 2013 14:43:55 +0200 Subject: [PATCH] Fixed #20962 -- Documented that template tag render() may raise exceptions. Thanks Keryn Knight for the report. --- AUTHORS | 1 + docs/howto/custom-template-tags.txt | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/AUTHORS b/AUTHORS index 74f0aae2f0..83d3e4fbc1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -277,6 +277,7 @@ answer newbie questions, and generally made Django that much better: Janos Guljas Thomas Güttler Horst Gutmann + Bouke Haarsma Antti Haapala Scot Hacker dAniel hAhler diff --git a/docs/howto/custom-template-tags.txt b/docs/howto/custom-template-tags.txt index c58444b9d6..1f6d2d5c75 100644 --- a/docs/howto/custom-template-tags.txt +++ b/docs/howto/custom-template-tags.txt @@ -478,8 +478,12 @@ Notes: * The ``render()`` method is where the work actually happens. -* ``render()`` should never raise ``TemplateSyntaxError`` or any other - exception. It should fail silently, just as template filters should. +* ``render()`` should generally fail silently, particularly in a production + environment where :setting:`DEBUG` and :setting:`TEMPLATE_DEBUG` are + ``False``. In some cases however, particularly if :setting:`TEMPLATE_DEBUG` is + ``True``, this method may raise an exception to make debugging easier. For + example, several core tags raise ``django.template.TemplateSyntaxError`` + if they receive the wrong number or type of arguments. Ultimately, this decoupling of compilation and rendering results in an efficient template system, because a template can render multiple contexts