#30509: Various FileResponse fixes and changes
--------------------------------------+------------------------------------
     Reporter:  Piotr Kunicki         |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  HTTP handling         |                  Version:  master
     Severity:  Normal                |               Resolution:
     Keywords:  FileResponse          |             Triage Stage:  Accepted
    Has patch:  1                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------
Changes (by Piotr Kunicki):

 * needs_better_patch:  1 => 0


Comment:

 1. Well, let's say you want to return a dynamically modified file, that
 you have an absolute path to - you open and edit it using Pillow or
 something similar, write result to a buffer, and then pass that buffer as
 the {{{filelike}}}, with the path as the {{{filename}}}. Sure, you could
 get the {{{basename}}} from the path and pass it instead, but... well now
 you don't have to.
 2. I'm not sure what you mean here, as the named pipe's {{{name}}} isn't
 an absolute path, but a file descriptor integer.\\
  However, regarding why would anyone pass an e.g. {{{BytesIO}}} buffer
 with a {{{name}}} set - i'm not sure (alternative way to pass the filename
 to the response?), but the point there was mostly to not assume that a
 {{{name}}} attribute means it's a file (unless it's the last option to get
 the {{{Content-Length}}} and such file actually exists?).

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30509#comment:3>
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/070.89c8f7057abdae844964a569b33a9fa4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to