diff --git a/colab/accounts/templatetags/gravatar.py b/colab/accounts/templatetags/gravatar.py
index 8b632be..78b0368 100644
--- a/colab/accounts/templatetags/gravatar.py
+++ b/colab/accounts/templatetags/gravatar.py
@@ -7,8 +7,8 @@ from colab.super_archives.models import EmailAddress
register = template.Library()
-@register.simple_tag
-def gravatar(email, size=80):
+@register.simple_tag(takes_context=True)
+def gravatar(context, email, size=80):
if isinstance(email, basestring):
try:
email = EmailAddress.objects.get(address=email)
@@ -17,4 +17,12 @@ def gravatar(email, size=80):
email_md5 = getattr(email, 'md5', 'anonymous')
- return u'
'.format(email_md5, size, size, size)
+ request = context.get('request')
+ if getattr(request, 'is_secure'):
+ protocol = 'https'
+ else:
+ protocol = 'http'
+
+ return (u'
').format(protocol, email_md5,
+ size, size, size)
--
libgit2 0.21.2