#25964: AttributeError: 'HttpResponse' object has no attribute '_reason_phrase'
------------------------------+--------------------
Reporter: Wtower | Owner: nobody
Type: Bug | Status: new
Component: Core (Other) | Version: 1.9
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
------------------------------+--------------------
When using Django 1.9 with wsgi, the following error occurs:
{{{
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] mod_wsgi
(pid=31977): Exception occurred processing WSGI script
'/var/www/vhosts/.../index.wsgi'.
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] Traceback (most
recent call last):
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] File
"/var/virtualenvs/ttours/lib/python3.4/site-
packages/django/core/handlers/wsgi.py", line 181, in __call__
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] status = '%s %s'
% (response.status_code, response.reason_phrase)
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] File
"/var/virtualenvs/ttours/lib/python3.4/site-
packages/django/http/response.py", line 63, in reason_phrase
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] if
self._reason_phrase is not None:
[Tue Dec 22 12:39:21 2015] [error] [client 94.68.52.160] AttributeError:
'HttpResponse' object has no attribute '_reason_phrase'
}}}
It appears that this has something to do with this recent change, as
indicated in 1.9 release notes:
django.http.responses.REASON_PHRASES and
django.core.handlers.wsgi.STATUS_CODE_TEXT have been removed. Use Python’s
stdlib instead: http.client.responses for Python 3 and httplib.responses
for Python 2.
But in django/core/handlers/wsgi.py
https://github.com/django/django/blob/stable/1.9.x/django/core/handlers/wsgi.py#L181
it clearly uses it:
{{{
status = '%s %s' % (response.status_code, response.reason_phrase)
}}}
This prevents Django 1.9 to be deployed in wsgi.
--
Ticket URL: <https://code.djangoproject.com/ticket/25964>
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/049.896de8058ff7992ced6d7691b9ac27a5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.