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 handle_update(**kwargs):
    if "issue_id" in kwargs:
        try:
            update_issue(settings.issue_folder, kwargs)
            return redirect("/issue?id={0}".format(kwargs.get("issue_id")[0]))
        except Exception as e:
            print (e)
    else:
        return redirect("/")
Esempio n. 3
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. 4
0
def add_comment(**kwargs):
    related_issue = kwargs.get("issue_related_id",[""]).pop()
    newstate = kwargs.get("newstate",[None]).pop()

    if related_issue != "":
        comment_id = create_comment(settings.issue_folder, kwargs.get("comments",[""]).pop(), related_issue)

    if newstate:
        comment_id = change_state(settings.issue_folder, related_issue, newstate)

    return redirect("/issue?id={0}#{1}".format(related_issue, comment_id))
Esempio n. 5
0
def handle_create(**kwargs):
    create_issue(settings.issue_folder, kwargs)
    return redirect("/")
Esempio n. 6
0
def redirect(**kwargs):
    return redirect("/")
Esempio n. 7
0
File: PVote.py Progetto: QGB/PVote
def index(**kwargs):
	return redirect('/DEMO.html')
Esempio n. 8
0
def redirect(**kwargs):
	return redirect("/")