Fix various bugs and styling issues

This commit is contained in:
Joseph Schorr 2014-11-24 19:40:03 -05:00
parent 7bf96c506f
commit 0e13ef3ff8
6 changed files with 15 additions and 10 deletions

View file

@ -35,6 +35,7 @@ class BaseAvatar(object):
class GravatarAvatar(BaseAvatar):
""" Avatar system that uses gravatar for generating avatars. """
def compute_hash(self, email, name=None):
email = email or ""
return hashlib.md5(email.strip().lower()).hexdigest()
def get_url(self, email, size=16, name=None):
@ -45,6 +46,7 @@ class GravatarAvatar(BaseAvatar):
class LocalAvatar(BaseAvatar):
""" Avatar system that uses the local system for generating avatars. """
def compute_hash(self, email, name=None):
email = email or ""
if not name and not email:
return ''