#27145 closed Cleanup/optimization (fixed)
Discrepenacy between documentation and docstring for Storage.save method
Reported by: | Sergei Zh | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.9 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Docstring for django.core.files.storage.Storage.save
method says:
""" Saves new content to the file specified by name. The content should be a proper File object or any python file-like object, ready to be read from the beginning. """
But in docs provided next description for content
attribute
The content argument must be an instance of django.core.files.File or of a subclass of File.
What about to update docs or add additional check in save
method?
Change History (5)
comment:1 by , 8 years ago
Component: | File uploads/storage → Documentation |
---|---|
Triage Stage: | Unreviewed → Accepted |
Type: | Uncategorized → Cleanup/optimization |
comment:2 by , 8 years ago
Has patch: | set |
---|---|
Summary: | Misunderstanding beetween documentation and docstring for Storage.save method → Discrepenacy between documentation and docstring for Storage.save method |
Looks like 664855b74e1f417384dc7aef35a3df5f86db52d6 added the option to use a file-like object but the docs weren't updated. Does this look like enough?
-
docs/ref/files/storage.txt
diff --git a/docs/ref/files/storage.txt b/docs/ref/files/storage.txt index dd06701..38f0135 100644
a b The ``Storage`` class 221 221 :meth:`get_available_name`. 222 222 223 223 The ``content`` argument must be an instance of 224 :class:`django.core.files.File` or of a subclass of 225 :class:`~django.core.files.File`. 224 :class:`django.core.files.File` or a file-like object. 226 225 227 226 .. method:: size(name)
Alternatively, maybe "or a file-like object that can be wrapped in File
".
comment:3 by , 8 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
The proposed patch seems good to me.
Thanks.
Note:
See TracTickets
for help on using tickets.
Hi,
I agree with you, there is a discrepancy here between the docstring and the documentation and we should correct that.
I have a feeling that the docstring might be the one that needs fixing but I am not sure. This will have to be determined.
Thanks.