def post(self): Id = int(getid()) tpl_path = os.path.join(STORE_PATH, "tmpl") with open(tpl_path, "r") as fp: tex = fp.read() title, tags = get_tex_info(tex) Storage.add(Id, title, tags, tex) return json.dumps({ "id":Id, "tex": tex, "status":0, })
def put(self): form = request.form Id = int(form.get("id")) md = form.get("md") html = form.get("html") post = int(form.get("post")) title, tags = get_tex_info(md) res = Storage.update(Id, title, tags, md, html, post) if not res: return json.dumps({ "status":1, "message": "id:%s is not exsit"%Id }) return json.dumps({ "status":0 })