fabric/fabric — pull request #593 by zyegfryed (2012-03-20 10:05:30+00:00)
Title: Fixed unicode error raised when using Jinja2 template with upload_template.

Hi,
I've stumbled upon this issue recently. The issue appears when using non-ascii characters on Jinja2 template.
In fact, when trying to submit data through SFTP connection, the resulted StringIO - passed to put function - is converted to bytes (str) which raise the exception.
The documentation says that temporary files are used when dealing with template, but the code was missing. I've added the code to deal with temporary files and a test.
Feel free to merge and to give any feedback on the patch.
Regards,
Sébastien