Exemplo n.º 1
0
def issue(**kwargs):
    if "id" not in kwargs:
        return redirect("/")

    # Load de l'issue
    try:
        id_issue = kwargs.get("id")[0]
        issue = json.load(open(join(settings.issue_folder,id_issue)))
    except:
        return redirect("/")

    # Decode description
    issue['id']         = id_issue
    issue['content']    = decode_markdown(issue.get("content", "")).decode("utf8")

    issue["comments"]   = []
    # Get related comments
    for f in sorted_ls("{0}/r{1}_*".format(settings.issue_folder, id_issue)):
        try:
            data = json.load(open(f))
            data["id"]      = os.path.basename(f)
            data["content"] = decode_markdown(data.get("content", "")).decode("utf8")
            name, email     = extract_email_author(data.get("author", "Anon <*****@*****.**>"))
            data["hash"]    = hashlib.md5(email).hexdigest()
            issue["comments"].append(data)
        except Exception as e:
            print (e)
            pass

    return render("issue.html", {"issue": issue, "labels": settings.labels, "authors": json.loads(get_author())})
Exemplo n.º 2
0
def author(**kwargs):
    author_list = []
    for author in json.loads(get_author()):
        try:
            name, email = extract_email_author(author)
            author_list.append({"name": name, "hash": hashlib.md5(email).hexdigest()})
        except Exception as e:
            author_list.append({"name": author})

    return render("author.html", {"authors": author_list})