You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a page which displays ~300 thumbnails using the ImageKit thumbnail template tag, but when a single file is not found then the entire page explodes. I encounter this when moving a database from prod to development for testing before I deploy if I don't move all of the accompanying source images and their generated thumbnails.
The Django Template guidelines suggest that tags should err gracefully, as any exception which is raised / not captured will cause such a server error:
Thus, filter functions should avoid raising exceptions if there is a reasonable fallback value to return. In case of input that represents a clear bug in a template, raising an exception may still be better than silent failure which hides the bug.
IMO, this is low priority as there is a workaround (Ensure that database file values link to valid files on disk), but thought I'd at least open an issue as the template tag doesn't adhere to the Django guideline. (It's not a template bug... it's a data issue.)
The text was updated successfully, but these errors were encountered:
This looks similar to this one #339. Actually not only with ImageKit if you have missing files and you try to get URL for them in templates it will crash in front of you. I know that is very bad user experience when for some missing file on the page the whole page is gone and you see 500 response.
We need to investigate it further to see how to improve the UX. If you have time and you are willing to came up with a PR I will be very glad.
I have a page which displays ~300 thumbnails using the ImageKit thumbnail template tag, but when a single file is not found then the entire page explodes. I encounter this when moving a database from prod to development for testing before I deploy if I don't move all of the accompanying source images and their generated thumbnails.
The Django Template guidelines suggest that tags should err gracefully, as any exception which is raised / not captured will cause such a server error:
IMO, this is low priority as there is a workaround (Ensure that database file values link to valid files on disk), but thought I'd at least open an issue as the template tag doesn't adhere to the Django guideline. (It's not a template bug... it's a data issue.)
The text was updated successfully, but these errors were encountered: