mariocesar/sorl-thumbnail — pull request #213 by coagulant (2014-01-08 13:08:16+00:00)
Title: Fix descriptor leak in convert engine

If source image is missing, IOError was raised and one of 2 opened file descriptors was not closed.
This led to nasty bug when whole python app worker failed, exhausing available descriptor limit.

Vitaly has fixed the issue by using `NamedTemporaryFile` instead of `mkstemp` and `open`,
thus eliminating the source of problem (descriptor is always closed, when exiting context manager).

I've written 3 tests to prove this code actually works.
Note, that `test_no_source_get_image fails` for code before this PR and passes after 0b8d666.
Unfortunately I managed to make unix-only test case, but I find this sufficient.

This finished work in #177, originally done by Vitaly @Olevinsky.