#32452: Simplify storing strings/bytes in a Storage
------------------------------------------------+------------------------
Reporter: Thomas Güttler | Owner: nobody
Type: New feature | Status: new
Component: File uploads/storage | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Docs: https://docs.djangoproject.com/en/3.1/topics/files/#storage-objects
> path = default_storage.save('path/to/file', ContentFile(b'new content'))
Things would be bit easier, if `save()` would support strings/bytes
directly.
This way a developer needs to type and import less code:
```
path = default_storage.save('path/to/file', b'new content')
```
```
path = default_storage.save('path/to/file', 'new unicode string, encoded
automatically with utf-8')
```
Would you accept a patch to `Storage.save()`?
--
Ticket URL: <https://code.djangoproject.com/ticket/32452>
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/050.01d9c64670510e7688492739626f344e%40djangoproject.com.