def gravatar(self, size=50, default='idention', rating='g'):
if request.is_secure:
url = 'https://cdn.v2ex.com/gravatar/' # ????????????
else:
url = 'http://cn.gravatar.com/avatar'
hash = hashlib.md5(self.email.encode('utf-8')).hexdigest()
return '{url}/{hash}?s={size}'.format(url=url, hash=hash, size=size)
评论列表
文章目录