#18764: HttpResponse._get_content shouldn't accept non-text types
-------------------------------------+-------------------------------------
     Reporter:  aaugustin            |                    Owner:  aaugustin
         Type:  Bug                  |                   Status:  new
    Component:  HTTP handling        |                  Version:  master
     Severity:  Release blocker      |               Resolution:
     Keywords:                       |             Triage Stage:  Ready for
    Has patch:  1                    |  checkin
  Needs tests:  0                    |      Needs documentation:  0
Easy pickings:  0                    |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

 * has_patch:  0 => 1
 * stage:  Accepted => Ready for checkin


Comment:

 I've just attached a patch that's consistent with the tickets I could find
 on this topic.

 `force_bytes` might be a bit overkill here but it has the following
 advantage:
 {{{
 >>> bytes(10)
 b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
 >>> from django.utils.encoding import smart_bytes
 >>> smart_bytes(10)
 b'10'
 }}}

 Allowing ASCII encoding when a `Content-Encoding` is set is still correct
 with regard to #4969: Python 2 allowed itself to perform `str` <=>
 `unicode` conversions of ASCII data transparently, making that explicit
 doesn't hurt.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/18764#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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to