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)
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)
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})
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)