Code

Opened 3 years ago

Last modified 3 years ago

#15799 new New feature

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

Reported by: jonash 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.

Attachments (0)

Change History (3)

comment:1 Changed 3 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Uncategorized to New 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 2 years ago by aaugustin

  • UI/UX unset

Change UI/UX from NULL to False.

comment:3 Changed 2 years ago by aaugustin

  • Easy pickings unset

Change Easy pickings from NULL to False.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.