Exemple #1
0
 def get_gravatar_hash(self):
     primary_email = self.get_primary_email()
     if primary_email:
         from htk.lib.gravatar.utils import get_gravatar_hash
         gravatar_hash = get_gravatar_hash(primary_email)
     else:
         gravatar_hash = ''
     return gravatar_hash
Exemple #2
0
 def get_gravatar_hash(self):
     primary_email = self.get_primary_email()
     if primary_email:
         from htk.lib.gravatar.utils import get_gravatar_hash
         gravatar_hash = get_gravatar_hash(primary_email)
     else:
         gravatar_hash = ''
     return gravatar_hash
Exemple #3
0
def format_suggest_username_name(user):
    from htk.lib.gravatar.utils import get_gravatar_hash
    obj = {
        'username' : user.username if user.profile.has_username_set else '',
        'first_name' : user.first_name.strip(),
        'last_name' : user.last_name.strip(),
        'display_name' : user.profile.get_display_name(),
        'gravatar_hash' : get_gravatar_hash(user.email),
    }
    return obj
Exemple #4
0
def gravatar_for_email(email, size=80):
    """
    https://en.gravatar.com/site/implement/images/
    """
    url = '%savatar/%s?' % (
        GRAVATAR_URL_PREFIX,
        get_gravatar_hash(email),
    )
    url += urllib.urlencode({
        's': str(size),
        'default': GRAVATAR_DEFAULT_IMAGE,
    })
    url = escape(url)
    return url
Exemple #5
0
def gravatar_for_email(email, size=80):
    """
    https://en.gravatar.com/site/implement/images/
    """
    url = '%savatar/%s?' % (
        GRAVATAR_URL_PREFIX,
        get_gravatar_hash(email),
    )
    url += urllib.urlencode(
        {
            's': str(size),
            'default': GRAVATAR_DEFAULT_IMAGE,
        }
    )
    url = escape(url)
    return url