Pay attention to tbicr .
In particular, this piece of code
gravatar = u.gravatar() gravatar_256 = u.gravatar(size=256) gravatar_pg = u.gravatar(rating='pg') gravatar_retro = u.gravatar(default='retro')
requires a request context, because it needs to access the query variable.
The definition of the gravatar method in the User Model needs the request variable.
def gravatar(self, size=100, default='identicon', rating='g'): if request.is_secure: # here url = 'https://secure.gravatar.com/avatar' else: url = 'http://www.gravatar.com/avatar' hash = self.avatar_hash or hashlib.md5(self.email.encode('utf-8')).hexdigest() return '{url}/{hash}?s={size}&d={default}&r={rating}'.format(url=url, hash=hash, size=size, default=default, rating=rating)
source share