Related to issue #1451: Catch non-existant object error and clear object attribute in DB accordingly #1465
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original PR: #1454
A brief description of the purpose of the changes contained in this PR.
This piece of code avoids crash when trying to access the size of a file that does not exist anymore in the storage. If an error is caught it then clears the file_size and data_file attribute in the DB.
Issues this PR resolves
Should solve Problem 1 of issue #1451
Simple test
A simple test would be to:
file_sizeattribute to -1 of one of the submission's dataset (table datasets_data)data_fileof the row in which you changed thefile_sizeattribute)save()method of the dataset object you modified. It will do some checks on the existence of the file in the storage and do the necessary updates. It should be something in those lines:Use case test
Checklist