def render_rev(self, rev, organization, gist): rev['view'] = get_url(organization, gist, version=rev['sha']) rev['committer_time'] = format_time(rev['committer_time']) author = reqcache.get(rev['author_email']) if not author: author = get_user_from_alias(rev['author_email']) reqcache.set(rev['author_email'], author) if not author: author = Obj() author.email = rev['author_email'] author.name = None rev['author'] = author rev['diff'] = render_diff(rev['diff'])
def render_commit(commit, organization, repo): commit['author_date'] = datetime.fromtimestamp(float( commit['author_time'])).date() commit['author_time'] = format_time(commit['author_time']) author = reqcache.get(commit['author_email']) if not author: author = get_user_from_alias(commit['author_email']) reqcache.set(commit['author_email'], author) if not author: author = Obj() author.email = commit['author_email'] author.name = None author.avatar = lambda size: get_avatar(author.email, size) commit['author'] = author
def get_commit_user(self, meta): user = Obj() commit = Obj() user.name = meta['committer']['name'] user.email = meta['committer']['email'] user.avatar = None commit.message = meta['message'] commit.user = user commit.sha = meta['sha'] commit.date = meta['committer']['date'] alias = get_alias_by_email(user.email) if alias: user = get_user(alias.uid) commit.user.name = user.name commit.user.avatar = user.avatar(18) return commit