philomat/django-media-tree — pull request #12 by gw0 (2012-06-14 03:21:31+00:00)
Title: Various fixes

I fixed a few bugs I came across while setting `django-media-tree` up on Django 1.4:

- The Javascript code for preloading background images in the admin file browser does not work with relative URLs that are written in `ui.css` (at least in Firefox 10) and results in requests to: `/admin/media_tree/filenode/%22http%3A//127.0.0.1%3A8000/static/media_tree/img/icons/folder-toggle.png%22/`

- In case of using a thumbnail generator/image resizer (at least for `easy_thumbnails`) the execution stops with an `IOError` exception if the file does not exist. The exception happens as a consequence of `{{ thumb.width }}` in `templates/media_tree/filenode/includes/figure_base.html` that wants to read the image file to determine its width (the results are stored in `ImageFile` dimension cache). This reading of files is unnecessary, because the dimensions of the thumbnail are already known to the template tag, and also to work around the common crash in case of missing files, I prepopulate the dimensions field.

- Django 1.4 also removed the deprecated `root_path` admin context variable that is not even used in `django-media-tree` and can therefore be removed.