cloudinary/pycloudinary — pull request #33 by nshafer (2014-05-13 20:00:09+00:00)
Title: Generate secure urls automatically

If you have a page that is SSL secured through HTTPS, all elements should be also be loaded through SSL to prevent browser errors from appearing to the user, and to prevent possible information leaks. Currently, if using cloudinary template tags, you have to specify secure=True manually every time you use it. I modified the two template tags that generate URLs to automatically set secure=True if three conditions are met:
- django.core.context_processors.request has been added to the site's TEMPLATE_CONTEXT_PROCESSORS setting.
https://docs.djangoproject.com/en/1.6/ref/settings/#std:setting-TEMPLATE_CONTEXT_PROCESSORS
https://docs.djangoproject.com/en/1.6/ref/templates/api/#django-core-context-processors-request

- The current request is served over a secure connection, and request.is_secure() returns True accordingly.
https://docs.djangoproject.com/en/1.6/ref/request-response/#django.http.HttpRequest.is_secure
https://docs.djangoproject.com/en/1.6/topics/security/#ssl-https

- The user hasn't specified a value for 'secure' in the template tag.

If any of those conditions are not met, the template tag will act like it always has, so should be backwards compatible.

Thanks,
Nathan Shafer