Beispiel #1
0
 def f(new, old, user, secobj):
     if new == 1:
         assert old == 2
         assert user == 3
         assert secobj == 4
     elif new == "bad":
         from couch_named_python import log, ForbiddenError
         log("Some sort of log")
         raise ForbiddenError("Some sort of error.")
     elif new == "what":
         from couch_named_python import UnauthorizedError
         raise UnauthorizedError("You shall not pass")
     elif new == "meh":
         {"a dict": True}["nonexistant key"]
 def f(new, old, user, secobj):
     if new == 1:
         assert old == 2
         assert user == 3
         assert secobj == 4
     elif new == "bad":
         from couch_named_python import log, ForbiddenError
         log("Some sort of log")
         raise ForbiddenError("Some sort of error.")
     elif new == "what":
         from couch_named_python import UnauthorizedError
         raise UnauthorizedError("You shall not pass")
     elif new == "meh":
         {"a dict": True}["nonexistant key"]
Beispiel #3
0
 def n6(head, req):
     from couch_named_python import Redirect, log
     log("bloop")
     raise Redirect("http://somewhere_else/")
Beispiel #4
0
 def n3(head, req):
     from couch_named_python import send, get_row, log
     assert get_row() == {"row": "one"}
     log("blah")
     assert get_row() == {"row": "two"}
Beispiel #5
0
 def map_three(doc):
     from couch_named_python import log
     if doc["word"] == "cow":
         yield doc["nonexistant"], False
     yield doc["something"], None
     log("From view test")
 def n6(head, req):
     from couch_named_python import Redirect, log
     log("bloop")
     raise Redirect("http://somewhere_else/")
 def n3(head, req):
     from couch_named_python import send, get_row, log
     assert get_row() == {"row": "one"}
     log("blah")
     assert get_row() == {"row": "two"}
 def map_three(doc):
     from couch_named_python import log
     if doc["word"] == "cow":
         yield doc["nonexistant"], False
     yield doc["something"], None
     log("From view test")