Esempio 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())})
Esempio n. 2
0
def update(**kwargs):
    try:
        id_issue = kwargs.get("id")[0]
        issue = json.load(open(join(settings.issue_folder,id_issue)))
        issue["content"] = base64.b64decode(issue["content"]).decode("utf8")
        return render("update.html", {"issue": issue, "issue_id": id_issue})
    except:
        return redirect("/")
Esempio n. 3
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})
Esempio n. 4
0
def home(**kwargs):
    # Get issue liste
    issue_list = []
    for f in sorted_ls("{0}/i*".format(settings.issue_folder)):
        try:
            issue = load_issue(settings.issue_folder,  os.path.basename(f))
            issue["id"] = os.path.basename(f)
            issue_list.append(issue)
        except Exception as e:
            print (e)
            pass

    return render("liste.html", {"issues": issue_list, "authors": json.loads(get_author())})
Esempio n. 5
0
def branch():
    logs = json.loads(get_log())
    formated_logs = []
    for log in logs:
        log = log.split(";")
        formated_logs.append({
        "commit_hash": log.pop(0),
        "username":log.pop(0),
        "hash":hashlib.md5(log.pop(0)).hexdigest(),
        "date":log.pop(0),
        "message":" ".join(log[:])
        })

    return render("log.html", {"logs": formated_logs})
Esempio n. 6
0
def create(**kwargs):
    return render("create.html", {"authors": json.loads(get_author()), "labels": settings.labels})
Esempio n. 7
0
def branch():
    return render("stats.html", {"stats": json.loads(get_stats()), "nb_commits": json.loads(get_number_of_commits())})
Esempio n. 8
0
def branch():
    return render("branch.html", {"branchs": json.loads(get_branch())})