#30294: HttpResponse doesn't handle memoryview objects
--------------------------------+------------------------------------
     Reporter:  Roger Hunwicks  |                    Owner:  nobody
         Type:  Bug             |                   Status:  new
    Component:  HTTP handling   |                  Version:  master
     Severity:  Normal          |               Resolution:
     Keywords:                  |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  1               |                    UI/UX:  0
--------------------------------+------------------------------------
Changes (by Simon Charette):

 * stage:  Unreviewed => Accepted


Comment:

 I guess `HttpResponseBase.make_bytes`
 
[https://github.com/django/django/blob/9caa3e0a29c54939cc923c1693f491ff6c8e77e2/django/http/response.py#L232-L233
 could be adapted] to deal with `memoryview` objects by casting them to
 `bytes`.

 In all cases simply wrapping the `memoryview` in `bytes` works as a
 workaround `HttpResponse(bytes(model.binary_field))`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30294#comment:1>
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/067.2fefc14ea5a65cc537d45823fd6bf4b5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to