def contributor(self, cid=None): if not cid: abort(404, detail="No contributor specified") c = Commits(index.Connector()) idents = Contributors() try: cid = utils.decrypt(xorkey, cid) except Exception: abort(404, detail="The cid is incorrectly formated") _, ident = idents.get_ident_by_id(cid) if not ident: # No ident has been declared for that contributor ident = list(idents.get_idents_by_emails(cid).values())[0] mails = ident['emails'] name = ident['name'] if not name: raw_names = c.get_commits_author_name_by_emails([cid]) if cid not in raw_names: # TODO: get_commits_author_name_by_emails must # support look by committer email too name = 'Unnamed' else: name = raw_names[cid] infos = {} infos['name'] = name infos['mails_amount'] = len(mails) infos['gravatar'] = hashlib.md5( ident['default-email'].encode(errors='ignore')).hexdigest() return infos
def contributor(self, cid=None): if not cid: abort(404, detail="No contributor specified") c = Commits(index.Connector()) idents = Contributors() try: cid = utils.decrypt(xorkey, cid) except Exception: abort(404, detail="The cid is incorrectly formated") _, ident = idents.get_ident_by_id(cid) if not ident: # No ident has been declared for that contributor ident = list(idents.get_idents_by_emails(cid).values())[0] mails = ident['emails'] name = ident['name'] if not name: raw_names = c.get_commits_author_name_by_emails([cid]) if cid not in raw_names: # TODO: get_commits_author_name_by_emails must # support look by committer email too name = 'Unnamed' else: name = raw_names[cid] infos = {} infos['name'] = name infos['mails_amount'] = len(mails) infos['gravatar'] = hashlib.md5( ident['default-email'].encode(errors='ignore')).hexdigest() return infos
def contributor(self, cid=None): if not cid: abort(404, detail="No contributor specified") try: cid = utils.decrypt(xorkey, cid) except Exception: abort(404, detail="The cid is incorrectly formated") c = Commits(index.Connector()) idents = Contributors() projects = Projects() _, ident = idents.get_ident_by_id(cid) if not ident: # No ident has been declared for that contributor ident = idents.get_idents_by_emails(cid).values()[0] mails = ident['emails'] name = ident['name'] if not name: raw_names = c.get_commits_author_name_by_emails([cid]) if cid not in raw_names: # TODO: get_commits_author_name_by_emails must # support look by committer email too name = 'Unnamed' else: name = raw_names[cid] p_filter = {} query_kwargs = { 'mails': mails, 'merge_commit': False, 'repos': p_filter, } tops_ctl = tops.TopProjectsController() top_projects = tops_ctl.gbycommits(c, projects, query_kwargs, False) top_repos = tops_ctl.gbycommits(c, projects, query_kwargs, True) infos = {} infos['name'] = name infos['mails_amount'] = len(mails) infos['projects_amount'] = len(top_projects) infos['repos_amount'] = len(top_repos) infos['gravatar'] = hashlib.md5(ident['default-email']).hexdigest() return infos