Example #1
0
def new_paste():
    id = db.new_paste(request.form.get("content"), helpers.get_ip(),
                      request.form.get("filename", None),
                      request.form.get("highlight", True),
                      request.form.get("convert_tabs", True))

    response = json_response({"id": id}, 201)
    response.headers["Location"] = url_for("get_paste", id=id)
    return response
Example #2
0
def new_paste():
    id = db.new_paste(request.form.get("content"),
                      helpers.get_ip(),
                      request.form.get("filename", None),
                      request.form.get("highlight", True),
                      request.form.get("convert_tabs", True))

    response = json_response({"id": id}, 201)
    response.headers["Location"] = url_for("get_paste", id = id)
    return response
Example #3
0
def new_paste():
    form = forms.NewPaste(request.form)
    if request.method == "POST" and form.validate():
        id = db.new_paste(form.content.data, helpers.get_ip(),
                          form.filename.data, form.highlight.data,
                          form.convert_tabs.data)

        if "pastes" not in session:
            session["pastes"] = []

        pastes = session["pastes"]
        pastes.append(id)
        session["paste"] = pastes

        return redirect(url_for("get_paste", id=id))

    return render_template("new.html", form=form)
Example #4
0
def new_paste():
    form = forms.NewPaste(request.form)
    if request.method == "POST" and form.validate():
        id = db.new_paste(
            form.content.data, helpers.get_ip(), form.filename.data, form.highlight.data, form.convert_tabs.data
        )

        if "pastes" not in session:
            session["pastes"] = []

        pastes = session["pastes"]
        pastes.append(id)
        session["paste"] = pastes

        return redirect(url_for("get_paste", id=id))

    return render_template("new.html", form=form)