Пример #1
0
def internal_server_error(req):
    traceback = format_exc()
    traceback = ''.join(traceback)
    req.log_error(traceback, state.LOG_ERR)

    req.status = state.HTTP_INTERNAL_SERVER_ERROR
    req.write(generate_page(req, "error/internal_server_error.html",
                            traceback=traceback.split('\n')))
    return state.DONE
Пример #2
0
def not_found(req):
    req.status = state.HTTP_NOT_FOUND
    req.write(generate_page(req, "error/not_found.html",
                            request_uri=req.environ['REQUEST_URI']))
    return state.DONE
Пример #3
0
def precondition_failed(req):
    req.status = state.HTTP_PRECONDITION_FAILED
    req.write(generate_page(req, "error/precondition_failed.html",
                            precondition=req.precondition))
    return state.DONE
Пример #4
0
def forbidden(req):
    req.status = state.HTTP_FORBIDDEN
    req.write(generate_page(req, "error/forbidden.html",
                            request_uri=req.environ['REQUEST_URI']))
    return state.DONE