This behavior should be altered to actually raise the error if a custom
`template_name` is specified.
The affected views are:
1. `django.views.defaults.page_not_found`
2. `django.views.defaults.server_error`
3. `django.views.defaults.bad_request`
4. `django.views.defaults.permission_denied`
Note that the views were identified during a preliminary search and it's
possible this pattern is used elsewhere in the Django code base.
We should consider deprecating this behavior instead of simply turning it
on since it's slightly backward incompatible.
Thanks to Raphael Michel at #DUTH for helping identifying this issue.
--
Ticket URL: <https://code.djangoproject.com/ticket/25697>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Old description:
> Default error views attempt to load a template from a default name and
> fallback to a string value if a `TemplateDoesNotExist` error is raised in
> the process.
>
> This behavior should be altered to actually raise the error if a custom
> `template_name` is specified.
>
> The affected views are:
>
> 1. `django.views.defaults.page_not_found`
> 2. `django.views.defaults.server_error`
> 3. `django.views.defaults.bad_request`
> 4. `django.views.defaults.permission_denied`
>
> Note that the views were identified during a preliminary search and it's
> possible this pattern is used elsewhere in the Django code base.
>
> We should consider deprecating this behavior instead of simply turning
> it on since it's slightly backward incompatible.
>
> Thanks to Raphael Michel at #DUTH for helping identifying this issue.
New description:
Default error views attempt to load a template from a default name and
fallback to a string value if a `TemplateDoesNotExist` error is raised in
the process.
This behavior should be altered to actually raise the error if a custom
`template_name` is specified.
The affected views are:
1. `django.views.defaults.page_not_found`
2. `django.views.defaults.server_error`
3. `django.views.defaults.bad_request`
4. `django.views.defaults.permission_denied`
Note that the views were identified during a preliminary search and it's
possible this pattern is used elsewhere in the Django code base.
We should consider deprecating this behavior instead of simply turning it
on since it's slightly backward incompatible.
Thanks to Raphael Michel at #DUTH for helping identifying this issue.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:1>
Comment (by carljm):
Yes, I think we'd need a deprecation path here where initially we raise a
PendingDeprecationWarning on an explicitly-specified nonexistent template,
then a DeprecationWarning, and then finally switch to raising the
TemplateNotFound.
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:2>
* owner: nobody => yakky
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:3>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:4>
Comment (by timgraham):
I'm lukewarm on deprecations (since it adds a lot of overhead for us)
instead of making minor backwards incompatible changes in cases like this
where it seems to simply delay revealing probable errors in user code. A
similar case was `select_related()` field name validation where we made a
backwards-incompatible change -- Carl, I believe you said you thought that
should have gone through a deprecation. Just wanted to bring it up for
discussion so I can crystallize my thinking around changes like this.
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:5>
* needs_better_patch: 0 => 1
* easy: 1 => 0
Comment:
No one indicated an opposition [https://groups.google.com/d/topic/django-
developers/Nl9tVI2ap3I/discussion on the mailing list] to skipping a
deprecation and making this a backwards incompatible change.
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:6>
Comment (by yakky):
Ok, I'll change the PR to avoid the deprecation period and edit the
changelog the reflect this change
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:7>
* needs_better_patch: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:8>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:9>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"21bf685f5e660a187fcac31e84d5cd89758aeb74" 21bf685]:
{{{
#!CommitTicketReference repository=""
revision="21bf685f5e660a187fcac31e84d5cd89758aeb74"
Fixed #25697 -- Made default error views error when passed a nonexistent
template_name.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25697#comment:10>