def status_to_type(status): if not FaultWrapper._status_to_type: for clazz in utils.walk_class_hierarchy(webob.exc.HTTPError): FaultWrapper._status_to_type[clazz.code] = clazz return FaultWrapper._status_to_type.get( status, webob.exc.HTTPInternalServerError)()
def name_to_type(name): if not FaultWrapper._name_to_type: for clazz in utils.walk_class_hierarchy(exception.NovaException): FaultWrapper._name_to_type[clazz.__name__] = clazz return FaultWrapper._name_to_type.get(name)
def __init__(self, application): self.status_to_type = {} for clazz in utils.walk_class_hierarchy(webob.exc.HTTPError): self.status_to_type[clazz.code] = clazz super(FaultWrapper, self).__init__(application)