Commit 7682cd7a authored by Michal Čihař's avatar Michal Čihař

Pass all params to libravatar

parent 3032b840
......@@ -55,19 +55,25 @@ def avatar_for_email(email, size=80):
Generates url for avatar.
'''
# Use libravatar library if available
if HAS_LIBRAVATAR:
return escape(libravatar.libravatar_url(email=email, https=True))
# Use libravatar library if available
url = libravatar.libravatar_url(
email=email,
https=True,
default=AVATAR_DEFAULT_IMAGE,
size=size
)
# Fallback to standard method
mail_hash = hashlib.md5(email.lower()).hexdigest()
else:
# Fallback to standard method
mail_hash = hashlib.md5(email.lower()).hexdigest()
url = "%savatar/%s?" % (AVATAR_URL_PREFIX, mail_hash)
url = "%savatar/%s?" % (AVATAR_URL_PREFIX, mail_hash)
url += urllib.urlencode({
's': str(size),
'd': AVATAR_DEFAULT_IMAGE
})
url += urllib.urlencode({
's': str(size),
'd': AVATAR_DEFAULT_IMAGE
})
return escape(url)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment