#27150: Document that a name should be provided when wrapping file-like objects
that don't have one with File
--------------------------------------+------------------------------------
     Reporter:  pacahon               |                    Owner:  nobody
         Type:  Cleanup/optimization  |                   Status:  new
    Component:  Documentation         |                  Version:  1.10
     Severity:  Normal                |               Resolution:
     Keywords:                        |             Triage Stage:  Accepted
    Has patch:  0                     |      Needs documentation:  0
  Needs tests:  0                     |  Patch needs improvement:  0
Easy pickings:  0                     |                    UI/UX:  0
--------------------------------------+------------------------------------

Comment (by pacahon):

 As I understood from #26495 python file-like objects works fine with
 `requests` library, because in CPython file objects use `object.__bool__`
 and always returns True if no `__bool__` and `__len__`.

 > I think documenting that you should pass a name for file-like objects
 that don't have one is the best course of action.

 It's little bit strange for me to allow pass `name=None` to
 `Storage.save`, while disallow use empty name for file-like objects. Maybe
 we can restore default `__bool__` behavior in `Storage.save` method?
 {{{
 content.__bool__ = lambda _: True
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/27150#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 [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/065.38058ec5d70766e28248f8ecde0e2a07%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to