]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Remove unused OverLimitFault
authorMark McLoughlin <markmc@redhat.com>
Tue, 17 Jul 2012 03:00:51 +0000 (04:00 +0100)
committerMark McLoughlin <markmc@redhat.com>
Tue, 17 Jul 2012 03:00:51 +0000 (04:00 +0100)
Only used by compute limits in Nova.

Change-Id: I065ca64e060acc0773189f1497fcc54041621f39

cinder/api/openstack/wsgi.py

index bb309056ead233700c918d0d163ffba318a1189c..9454e961c98d9d638a77e3b5baab2073c5cb71d5 100644 (file)
@@ -1070,53 +1070,6 @@ class Fault(webob.exc.HTTPException):
         return self.wrapped_exc.__str__()
 
 
-class OverLimitFault(webob.exc.HTTPException):
-    """
-    Rate-limited request response.
-    """
-
-    def __init__(self, message, details, retry_time):
-        """
-        Initialize new `OverLimitFault` with relevant information.
-        """
-        hdrs = OverLimitFault._retry_after(retry_time)
-        self.wrapped_exc = webob.exc.HTTPRequestEntityTooLarge(headers=hdrs)
-        self.content = {
-            "overLimitFault": {
-                "code": self.wrapped_exc.status_int,
-                "message": message,
-                "details": details,
-            },
-        }
-
-    @staticmethod
-    def _retry_after(retry_time):
-        delay = int(math.ceil(retry_time - time.time()))
-        retry_after = delay if delay > 0 else 0
-        headers = {'Retry-After': '%d' % retry_after}
-        return headers
-
-    @webob.dec.wsgify(RequestClass=Request)
-    def __call__(self, request):
-        """
-        Return the wrapped exception with a serialized body conforming to our
-        error format.
-        """
-        content_type = request.best_match_content_type()
-        metadata = {"attributes": {"overLimitFault": "code"}}
-
-        xml_serializer = XMLDictSerializer(metadata, XMLNS_V1)
-        serializer = {
-            'application/xml': xml_serializer,
-            'application/json': JSONDictSerializer(),
-        }[content_type]
-
-        content = serializer.serialize(self.content)
-        self.wrapped_exc.body = content
-
-        return self.wrapped_exc
-
-
 def _set_request_id_header(req, headers):
     context = req.environ.get('cinder.context')
     if context: