From e2ae91230947820c78ffd780fec662a204c08cd9 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 28 Jul 2008 10:16:51 +0000 Subject: [PATCH] Replace httperror module with ganeti.http The generic HTTP server doesn't know about httperror based exceptions and would treat them as unknown exceptions, thereby not doing the right thing with HTTP errors. Reviewed-by: iustinp --- lib/rapi/RESTHTTPServer.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/rapi/RESTHTTPServer.py b/lib/rapi/RESTHTTPServer.py index 11c83b788..0dd6556b9 100644 --- a/lib/rapi/RESTHTTPServer.py +++ b/lib/rapi/RESTHTTPServer.py @@ -25,7 +25,6 @@ from ganeti import http from ganeti import errors from ganeti import rpc from ganeti.rapi import connector -from ganeti.rapi import httperror class RESTRequestHandler(http.HTTPRequestHandler): @@ -35,7 +34,7 @@ class RESTRequestHandler(http.HTTPRequestHandler): def setup(self): super(RESTRequestHandler, self).setup() self._resmap = connector.Mapper() - + def HandleRequest(self): """ Handels a request. @@ -47,7 +46,7 @@ class RESTRequestHandler(http.HTTPRequestHandler): try: fn = getattr(handler, command) except AttributeError, err: - raise httperror.HTTPBadRequest() + raise http.HTTPBadRequest() try: result = fn() @@ -55,8 +54,8 @@ class RESTRequestHandler(http.HTTPRequestHandler): except errors.OpPrereqError, err: # TODO: "Not found" is not always the correct error. Ganeti's core must # differentiate between different error types. - raise httperror.HTTPNotFound(message=str(err)) - + raise http.HTTPNotFound(message=str(err)) + return result -- GitLab