def h(doc, req): from couch_named_python import NotFoundError, Redirect, send send("Some text") if doc == None: raise NotFoundError("Help") elif "nf" in doc: raise NotFoundError() elif "meh" in doc: raise Redirect("/somewhere_else") elif "wat" in doc: raise Redirect("/wat", permanent=True)
def n1(head, req): from couch_named_python import start, send, get_row assert head == {"some header": True} assert req == {"test_req": True} start({"code": 100}) send("hello world") assert get_row() == {"row": "one"} assert get_row() == {"row": "two"} send("moo") send("baa") assert get_row() == None send("whatever") assert get_row() == None
def n2(head, req): from couch_named_python import send, get_row send("test two") assert get_row() == None send("suffix")
def g(doc, req): from couch_named_python import start, send start({"code": 403}) send("You can't be here\n") send("It's dangerous\n")