#30694: Document FileResponse does not seek its file source
-------------------------------+--------------------------------------
     Reporter:  Claude Paroz   |                    Owner:  nobody
         Type:  Bug            |                   Status:  closed
    Component:  Documentation  |                  Version:  2.2
     Severity:  Normal         |               Resolution:  wontfix
     Keywords:                 |             Triage Stage:  Unreviewed
    Has patch:  0              |      Needs documentation:  0
  Needs tests:  0              |  Patch needs improvement:  0
Easy pickings:  0              |                    UI/UX:  0
-------------------------------+--------------------------------------
Changes (by Claude Paroz):

 * component:  HTTP handling => Documentation


Comment:

 Something like that?:
 {{{
 diff --git a/docs/ref/request-response.txt b/docs/ref/request-response.txt
 index 19593dfb90..3dfbf28cf6 100644
 --- a/docs/ref/request-response.txt
 +++ b/docs/ref/request-response.txt
 @@ -1122,6 +1122,8 @@ Attributes

      If ``open_file`` doesn't have a name or if the name of ``open_file``
 isn't
      appropriate, provide a custom file name using the ``filename``
 parameter.
 +    Note that if you pass a file-like object like ``io.BytesIO``, it's
 your
 +    task to ``seek()`` it before passing it to ``FileResponse``.

      The ``Content-Length`` and ``Content-Type`` headers are automatically
 set
      when they can be guessed from contents of ``open_file``.
 }}}
 I suspect the example in https://docs.djangoproject.com/en/2.2/howto
 /outputting-pdf/#write-your-view is missing the seek call.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/30694#comment:2>
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/065.156d3067e2025379c6a127750615a8a2%40djangoproject.com.

Reply via email to