6 class restart(Exception):
19 class iterproxy(object):
20 # Makes sure iter(real).next() is called immediately, in order to
21 # let generator code run.
22 def __init__(self, real):
32 if self._next is None:
36 self._next[:] = [self.bki.next()]
42 if hasattr(self.bk, "close"):
45 def defaulterror(req, excinfo):
47 traceback.print_exception(*excinfo)
48 raise resp.httperror(500)
50 def wraphandler(handler, excinfo):
52 return handler(req, excinfo)
55 errorhandler = env.var(defaulterror)
57 def handle(req, startreq, handler):
63 resp = iterproxy(handler(req))
70 handler = wraphandler(eh, sys.exc_info())