#12064: Impossible to conditionally include potentially non-existant templates
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  nobody
  mkruisselbrink                     |         Status:  new
                   Type:  New        |      Component:  Template system
  feature                            |       Severity:  Normal
              Milestone:             |       Keywords:
                Version:  1.1        |      Has patch:  1
             Resolution:             |    Needs tests:  1
           Triage Stage:  Design     |  Easy pickings:  0
  decision needed                    |
    Needs documentation:  0          |
Patch needs improvement:  0          |
-------------------------------------+-------------------------------------
Changes (by mrmachine):

 * easy:   => 0


Comment:

 See also #16147

 I believe that the behaviour of `{% include %}` as it stands is both
 inconsistent between development (`TEMPLATE_DEBUG = True`) and production
 environments, but also within the tag itself depending on the type of
 argument passed to it. These inconsistencies have shown themselves in a
 few different buggy (or at least unexpected) ways that are not always easy
 to trace.

 If including a non-existent template is worth raising TemplateDoesNotExist
 in a development environment, it should not fail silently in a production
 environment. The exception should also be raised there and redirected to
 admins via Django's logging.

 If including a non-existent template should fail silently when the
 template does not exist, it should do so both for includes that have a
 literal string argument or a variable, and it should do so both in
 development and production environments.

 I don't really have a firm opinion on whether or not including missing
 templates should always fail silently or loudly, although I believe the
 most common and expected behaviour currently is to fail silently so there
 may be backwards incompatible issues in changing that. But I do believe
 that the `{% include %}` tag should work it's magic at render time for
 both literal and variable arguments. I consider the currently
 (undocumented) difference in behaviour to be buggy or at the very least,
 surprising.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/12064#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to