Esempio n. 1
0
def addPost():
    if not user.current_user():
        abort(403)

    url = request.form["url"]
    link.add(user.current_user(), url)

    if request.form.has_key("redirect"):
        return redirect(url)

    return redirect(url_for("index"))
Esempio n. 2
0
def add():
    if not user.current_user():
        abort(403)

    default_url = request.args.get("url", "")

    return render_template("add.html", default_url=default_url)
Esempio n. 3
0
def link_push():
    url = request.form['url']
    link.add(user.current_user(), url)
    return jsonify(success=True)
Esempio n. 4
0
def link_list():
    db_links = link.get(user.current_user())
    links = []
    for db_link in db_links:
        links.append(dict(zip(['id', 'url'], db_link)))
    return jsonify(success=True,links=links)
Esempio n. 5
0
def link_delete(link_id):
    ret = link.delete(user.current_user(), link_id)
    return jsonify(success=(ret==1))
Esempio n. 6
0
def list():
    if not user.current_user():
        abort(403)

    links = link.get(user.current_user())
    return render_template("list.html", links=links)