def edit_do(request, id_, **kwargs): content = request.form.get("content", "") action = request.form.get("action", "") action = action.lower() if action == "delete": deldata = document.delete(notedb(), xapdb, id_) if deldata is None: return notfound() else: updatedata = document.update(notedb(), xapdb, id_, content) if updatedata is None: return notfound() return redirect("document.index")
def latest(**kwargs): docs = document.latest(notedb()) return jsonresponse([{ "id": doc[0], "text": doc[1], "date": doc[2] } for doc in docs], indent=4)
def edit(id_, **kwargs): doc = document.get(notedb(), id_) if doc is None: return notfound() return templateresponse("/page/editor.mako", id_=id_, content=doc[1])
def search(request, **kwargs): query = request.args.get("q", "") result = document.search(notedb(), xapdb, query) return jsonresponse(result)
def create_do(request, **kwargs): content = request.form.get("content", "") document.create(notedb(), xapdb, content) return redirect("document.index")