Opened 5 years ago

Last modified 5 years ago

#15799 new New feature

Document what exception should be raised when trying to open non-existent file

Reported by: Jonas H. Owned by: nobody
Component: File uploads/storage Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

What should custom storage backends raise if the file trying to open does not exist? (In Storage._open) That's not documented anywhere.

Change History (3)

comment:1 Changed 5 years ago by Carl Meyer

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset
Triage Stage: UnreviewedAccepted
Type: UncategorizedNew feature

I can't find anywhere in Django that tries to catch an exception from calling .open() on a storage backend, and Django's FileSystemStorage doesn't catch the IOError and re-raise anything else, so at the moment I don't believe there is any such standard to document. For maximum compatibility with FileSystemStorage you'd want to raise IOError, I suppose.

I can see valid use cases (i.e. in reusable apps) for having some common exceptions standardized as part of the Storage interface, so accepting this as a feature request (not necessarily just for documentation, as FileSystemStorage should also use the common exception, and I'm not sure it should be IOError).

comment:2 Changed 5 years ago by Aymeric Augustin

UI/UX: unset

Change UI/UX from NULL to False.

comment:3 Changed 5 years ago by Aymeric Augustin

Easy pickings: unset

Change Easy pickings from NULL to False.

Note: See TracTickets for help on using tickets.
Back to Top