def post(self): if "content" not in request.form.keys(): return redirect(url_for('index')) content = request.form['content'] p = Paste(content) db_session.add(p) db_session.commit() extension = language_detect(content)[1] return url_for('view', id=encode_id(p.id), extension=extension)
def get_language(self, id, content, extension="txt"): extension = language_detect(str(content))[1] return get_language_from_extension(extension)