summaryrefslogtreecommitdiff
path: root/trove/common/wsgi.py
diff options
context:
space:
mode:
authorAmrith Kumar <amrith@tesora.com>2014-12-10 15:17:46 -0500
committeramrith <amrith@tesora.com>2015-01-06 18:43:38 +0000
commitf86a0e6cc283cd786d244b394892ced8bc32eeaa (patch)
treef70e086a965549d87a934575e2ec13c1b528644c /trove/common/wsgi.py
parentfb83a84e62489e822ae44bbef74faa467e443632 (diff)
downloadtrove-f86a0e6cc283cd786d244b394892ced8bc32eeaa.tar.gz
Obsolete oslo-incubator modules - wsgi
This change is part of a multi-part change set to handle obsolete and graduated oslo modules. This commit handles the wsgi module. The way in which other projects appear to have handled this situation is to copy the wsgi module into the project. See, for example, https://review.openstack.org/#/c/129260/ I've done the same thing, and since we already have a wsgi module in trove/common, I've called the newly imported module base_wsgi.py and renamed the imports accordingly. In the fullness of time, we could consider merging wsgi.py and base_wsgi.py However since there are internal dependencies between middleware/context.py and wsgi.py (within oslo-incubator) I can't delete or modify those files. This change has been rebased on https://review.openstack.org/#/c/133051/ Change-Id: I029b7f569342f768ebcdfc2fb7224f4f7f00d48c Partial-Bug: #1380789 blueprint: retire-unused-trove-modules
Diffstat (limited to 'trove/common/wsgi.py')
-rw-r--r--trove/common/wsgi.py34
1 files changed, 17 insertions, 17 deletions
diff --git a/trove/common/wsgi.py b/trove/common/wsgi.py
index 359d0864..d2056843 100644
--- a/trove/common/wsgi.py
+++ b/trove/common/wsgi.py
@@ -34,16 +34,16 @@ from oslo.serialization import jsonutils
from trove.openstack.common import pastedeploy
from trove.openstack.common import service
-from trove.openstack.common import wsgi as openstack_wsgi
+from trove.common import base_wsgi
from trove.openstack.common import log as logging
from trove.common import cfg
CONTEXT_KEY = 'trove.context'
-Router = openstack_wsgi.Router
-Debug = openstack_wsgi.Debug
-Middleware = openstack_wsgi.Middleware
-JSONDictSerializer = openstack_wsgi.JSONDictSerializer
-RequestDeserializer = openstack_wsgi.RequestDeserializer
+Router = base_wsgi.Router
+Debug = base_wsgi.Debug
+Middleware = base_wsgi.Middleware
+JSONDictSerializer = base_wsgi.JSONDictSerializer
+RequestDeserializer = base_wsgi.RequestDeserializer
CONF = cfg.CONF
# Raise the default from 8192 to accommodate large tokens
@@ -78,8 +78,8 @@ def launch(app_name, port, paste_config_file, data={},
"""
app = pastedeploy.paste_deploy_app(paste_config_file, app_name, data)
- server = openstack_wsgi.Service(app, port, host=host,
- backlog=backlog, threads=threads)
+ server = base_wsgi.Service(app, port, host=host,
+ backlog=backlog, threads=threads)
return service.launch(server, workers)
@@ -149,7 +149,7 @@ class VersionedURLMap(object):
return app(environ, start_response)
-class Router(openstack_wsgi.Router):
+class Router(base_wsgi.Router):
# Original router did not allow for serialization of the 404 error.
# To fix this the _dispatch was modified to use Fault() objects.
@staticmethod
@@ -168,7 +168,7 @@ class Router(openstack_wsgi.Router):
return app
-class Request(openstack_wsgi.Request):
+class Request(base_wsgi.Request):
@property
def params(self):
return utils.stringify_keys(super(Request, self).params)
@@ -229,7 +229,7 @@ class Result(object):
return self._data
-class Resource(openstack_wsgi.Resource):
+class Resource(base_wsgi.Resource):
def __init__(self, controller, deserializer, serializer,
exception_map=None):
exception_map = exception_map or {}
@@ -413,9 +413,9 @@ class Controller(object):
if key in ["limit", "marker"]])
-class TroveResponseSerializer(openstack_wsgi.ResponseSerializer):
+class TroveResponseSerializer(base_wsgi.ResponseSerializer):
def serialize_body(self, response, data, content_type, action):
- """Overrides body serialization in openstack_wsgi.ResponseSerializer.
+ """Overrides body serialization in base_wsgi.ResponseSerializer.
If the "data" argument is the Result class, its data
method is called and *that* is passed to the superclass implementation
@@ -499,7 +499,7 @@ class Fault(webob.exc.HTTPException):
content_type = req.best_match_content_type()
serializer = {
- 'application/json': openstack_wsgi.JSONDictSerializer(),
+ 'application/json': base_wsgi.JSONDictSerializer(),
}[content_type]
self.wrapped_exc.body = serializer.serialize(fault_data, content_type)
@@ -507,7 +507,7 @@ class Fault(webob.exc.HTTPException):
return self.wrapped_exc
-class ContextMiddleware(openstack_wsgi.Middleware):
+class ContextMiddleware(base_wsgi.Middleware):
def __init__(self, application):
self.admin_roles = CONF.admin_roles
super(ContextMiddleware, self).__init__(application)
@@ -554,10 +554,10 @@ class ContextMiddleware(openstack_wsgi.Middleware):
return _factory
-class FaultWrapper(openstack_wsgi.Middleware):
+class FaultWrapper(base_wsgi.Middleware):
"""Calls down the middleware stack, making exceptions into faults."""
- @webob.dec.wsgify(RequestClass=openstack_wsgi.Request)
+ @webob.dec.wsgify(RequestClass=base_wsgi.Request)
def __call__(self, req):
try:
resp = req.get_response(self.application)