#24139: The response reason phrases should evaluate lazily
-------------------------------+------------------------------------
     Reporter:  jdufresne      |                    Owner:  nobody
         Type:  New feature    |                   Status:  new
    Component:  HTTP handling  |                  Version:  master
     Severity:  Normal         |               Resolution:
     Keywords:                 |             Triage Stage:  Accepted
    Has patch:  1              |      Needs documentation:  1
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+------------------------------------

Comment (by jdufresne):

 > Is it documented that you can set HttpResponse.status_code outside of
 the constructor?

 Grepping for "status_code" and "status" in `docs` shows the following:

 {{{
 ./request-response.txt:663:

 .. method:: HttpResponse.__init__(content='', content_type=None,
 status=200, reason=None, charset=None)

     ``status`` is the `HTTP status code`_ for the response.


 ./ref/request-response.txt:639:

 .. attribute:: HttpResponse.status_code

     The `HTTP status code`_ for the response.
 }}}


 Nothing about this indicates to me that I ''shouldn't'' change
 `status_code` outside the constructor.

 This was originally a problem for me as I was using `render_to_response`
 in Django 1.6. This version does not accept `status` as a kwarg. I was
 trying to change the `status_code` of the return value. This is when I
 noticed the reason phrase was incorrect.

 > If we're adding code to support setting this attribute, it should be
 documented. If it's already documented, the change in behavior should be
 documented.

 Will do.

--
Ticket URL: <https://code.djangoproject.com/ticket/24139#comment:4>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.3913f877474b02868493672908fe30fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to