def post(self): password = self.get_argument("password") id = self.get_argument("id") e = self.db.get("SELECT * FROM entries WHERE id = %s", int(id)) if checkuserpass(password, e["password"]): self.set_secure_cookie("codeid", str(id)) self.redirect("/update/" + str(id)) else: self.redirect("/" + str(id))
def post(self): password = self.get_argument("password") id = self.get_argument("id") e = self.db.get("SELECT * FROM entries WHERE id = %s", int(id)) if checkuserpass(password, e["password"]): self.db.execute("DELETE FROM entries WHERE id=%s", int(id)) self.redirect("/") else: self.redirect("/" + str(id))
def post(self, codeid): title = xhtml_escape(self.get_argument("title")) tep = self.get_argument("info") code = xhtml_escape(self.get_argument("code")) pswd = self.get_argument("password") info = md.convert(tep) codes = self.db.get("SELECT * FROM entries WHERE id = %s", int(codeid)) if checkuserpass(pswd, codes["password"]): self.db.execute(""" UPDATE entries SET title = %s, info = %s, code = %s, markdown = %s WHERE id = %s""", title, info, code, tep, int(codeid)) self.clear_cookie("codeid") self.redirect("/" + str(codeid)) else: self.redirect("/" + str(codeid))
def post(self, codeid): title = xhtml_escape(self.get_argument("title")) tep = self.get_argument("info") code = xhtml_escape(self.get_argument("code")) pswd = self.get_argument("password") info = md.convert(tep) codes = self.db.get("SELECT * FROM entries WHERE id = %s", int(codeid)) if checkuserpass(pswd, codes["password"]): self.db.execute( """ UPDATE entries SET title = %s, info = %s, code = %s, markdown = %s WHERE id = %s""", title, info, code, tep, int(codeid)) self.clear_cookie("codeid") self.redirect("/" + str(codeid)) else: self.redirect("/" + str(codeid))