#26915: Template response middleware skipped for responses returned from view
middleware
-------------------------------+--------------------
     Reporter:  AlexHill       |      Owner:  nobody
         Type:  Bug            |     Status:  new
    Component:  HTTP handling  |    Version:  1.10
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 Hi,

 I upgraded a project from 1.9 to 1.10rc1 to test the waters. There's a
 regression when returning a response object from a view middleware -
 Django 1.10 does not apply template response middleware to the response,
 or render it when required.

 As well as your template response middleware being skipped, the unrendered
 response causes trouble when passed to a lot of response middleware which
 expects response.content to be set.

 When you do this in Django 1.9, remaining view middleware is skipped, but
 template response middleware is applied and the response is rendered.

 See the difference:

 1.9:
 
https://github.com/django/django/blob/stable/1.9.x/django/core/handlers/base.py#L138

 1.10:
 
https://github.com/django/django/blob/stable/1.10.x/django/core/handlers/base.py#L176

 I couldn't find any reference to this in the release notes so I'm assuming
 it's not intentional. Restoring the `break` statement and the following
 `if response is None` block restores the old behaviour without breaking
 any tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/26915>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.437aafbc652371d1710eb1da3d03f789%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to