This commit is contained in:
Khanh Ngo
2018-04-09 18:50:55 +07:00
parent 5354d27f88
commit 060e0917bc
2 changed files with 3 additions and 1 deletions

View File

@ -196,6 +196,9 @@ def email_to_gravatar_url(email="", size=100):
"""
AD doesn't necessarily have email
"""
if email is None:
email = ""
hash_string = hashlib.md5(email.encode('utf-8')).hexdigest()
return "https://s.gravatar.com/avatar/{0}?s={1}".format(hash_string, size)