예제 #1
0
def get_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    return render_template("paste.html", paste=paste)
예제 #2
0
파일: views.py 프로젝트: ryanc/mmmpaste
def get_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    return render_template("paste.html", paste=paste)
예제 #3
0
def get_latest_paste():
    paste = db.get_paste()

    if paste is None:
        error = "The pastebin is empty."
        return render_template("error.html", error=error), 404

    return redirect(url_for("get_paste", id=paste.id_b62), 307)
예제 #4
0
파일: views.py 프로젝트: ryanc/mmmpaste
def get_latest_paste():
    paste = db.get_paste()

    if paste is None:
        error = "The pastebin is empty."
        return render_template("error.html", error=error), 404

    return redirect(url_for("get_paste", id=paste.id_b62), 307)
예제 #5
0
파일: rest.py 프로젝트: ryanc/mmmpaste
def get_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        return json_error("Paste not found.", 404)

    response = make_response(str(paste.content))
    response.mimetype = "text/plain"
    return response
예제 #6
0
def get_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        return json_error("Paste not found.", 404)

    response = make_response(str(paste.content))
    response.mimetype = "text/plain"
    return response
예제 #7
0
def get_raw_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    response = make_response(str(paste.content))
    response.mimetype = "text/plain"
    return response
예제 #8
0
def clone_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    form = forms.NewPaste()
    form.content.data = str(paste.content)
    return render_template("new.html", form=form)
예제 #9
0
파일: views.py 프로젝트: ryanc/mmmpaste
def get_raw_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    response = make_response(str(paste.content))
    response.mimetype = "text/plain"
    return response
예제 #10
0
파일: views.py 프로젝트: ryanc/mmmpaste
def clone_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    form = forms.NewPaste()
    form.content.data = str(paste.content)
    return render_template("new.html", form=form)
예제 #11
0
파일: views.py 프로젝트: ryanc/mmmpaste
def download_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    filename = paste.filename

    if filename is None:
        filename = "paste-%s.txt" % paste.id_b62

    response = make_response(str(paste.content))
    response.headers["Content-Disposition"] = "attachment; filename=%s" % filename
    return response
예제 #12
0
def download_paste(id):
    paste = db.get_paste(id)

    if paste is None:
        error = "This paste is no longer available."
        return render_template("error.html", error=error), 404

    filename = paste.filename

    if filename is None:
        filename = "paste-%s.txt" % paste.id_b62

    response = make_response(str(paste.content))
    response.headers[
        "Content-Disposition"] = "attachment; filename=%s" % filename
    return response