benoitbryon/django-downloadview — pull request #24 by benoitbryon (2012-12-13 18:15:25+00:00)
Title: Refs #21 and refs #23 - Download view passes a file wrapper to download response

The file wrapper encapsulates file attributes such as name, size or URL (introduced URL).

**Introduces API changes!**

Views get lighter, the main trick is now to instanciate the right file wrapper:

* can use FieldFile for files that live in models (FileField, ImageField). Works out of the box!
* introduced a file wrapper for files that live in storage but which doesn't belong to a model. The wrapper is mainly a proxy mixing storage class and django.core.files.File.
* can use django.core.files.File as wrapper for most "simple" files. And optionaly override attributes such as size, name and url.

As a consequence, started refactoring in nginx optimizations: replaced (media_url, media_root) by (source_dir, source_url, destination_url).