Ejemplo n.º 1
0
def view(uid):
    row = getCode(uid)
    if row is None:
        return render_template('error.html', uid=uid)
    d = dict(uid=uid,
             code=row[0],
             lang=row[1],
             url="{}view/{}".format(request.host_url, uid))
    return render_template('view.html', **d)
Ejemplo n.º 2
0
def edit(uid):
    code = getCode(uid)
    if code is None:
        return render_template('error.html', uid=uid)
    d = dict(uid=uid,
             code=code,
             languages=languages,
             url=f"{request.host_url}view/{uid}")
    return render_template('edit.html', **d)
Ejemplo n.º 3
0
def publish():
    content = request.form['content']
    uid = request.form['uid']
    language = request.form['language']

    updateCode(uid, content, language)
    createLog(request.remote_addr, request.user_agent.string)
    result = getCode(uid)

    return jsonify({'ok': True, 'code': result})
Ejemplo n.º 4
0
def view(uid):
    row = getCode(uid)

    if row is None:
        return render_template('error.html',uid = uid)

    d = dict(
        uid=uid,
        code = colorize(row[0], row[1]),
        language=row[1],
        createdAt = row[2],
        updatedAt = row[3],
        url="{}view/{}".format(request.host_url,uid)
    )

    return render_template('view.html', **d)