Skip to content

Commit

Permalink
Avatar: do not use default URL for gravatar
Browse files Browse the repository at this point in the history
gravatar will serve default avatars itself, which do not work when the bot is in an intranet
We'd better use same default as github (retro)
  • Loading branch information
Pierre Tardy committed Feb 27, 2015
1 parent 0aef465 commit 14aee59
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions master/buildbot/www/avatar.py
Expand Up @@ -31,11 +31,16 @@ def getUserAvatar(self, email, size, defaultAvatarUrl):

class AvatarGravatar(AvatarBase):
name = "gravatar"
# gravatar does not want intranet URL, which is most of where the bots are
# just use same default as github (retro)
default = "retro"

def getUserAvatar(self, email, size, defaultAvatarUrl):
# construct the url
gravatar_url = "//www.gravatar.com/avatar/"
gravatar_url += hashlib.md5(email.lower()).hexdigest() + "?"
if self.default != "url":
defaultAvatarUrl = self.default
gravatar_url += urllib.urlencode({'s': str(size), 'd': defaultAvatarUrl})
raise resource.Redirect(gravatar_url)

Expand Down

0 comments on commit 14aee59

Please sign in to comment.