summaryrefslogtreecommitdiffstats
path: root/openstack/common/middleware
diff options
context:
space:
mode:
Diffstat (limited to 'openstack/common/middleware')
-rw-r--r--openstack/common/middleware/base.py17
-rw-r--r--openstack/common/middleware/context.py11
-rw-r--r--openstack/common/middleware/debug.py12
-rw-r--r--openstack/common/middleware/sizelimit.py3
4 files changed, 18 insertions, 25 deletions
diff --git a/openstack/common/middleware/base.py b/openstack/common/middleware/base.py
index 624a391..7236731 100644
--- a/openstack/common/middleware/base.py
+++ b/openstack/common/middleware/base.py
@@ -18,18 +18,16 @@ import webob.dec
class Middleware(object):
- """
- Base WSGI middleware wrapper. These classes require an application to be
- initialized that will be called next. By default the middleware will
- simply call its wrapped app, or you can override __call__ to customize its
- behavior.
+ """Base WSGI middleware wrapper.
+
+ These classes require an application to be initialized that will be called
+ next. By default the middleware will simply call its wrapped app, or you
+ can override __call__ to customize its behavior.
"""
@classmethod
def factory(cls, global_conf, **local_conf):
- """
- Factory method for paste.deploy
- """
+ """Factory method for paste.deploy."""
def filter(app):
return cls(app)
@@ -40,8 +38,7 @@ class Middleware(object):
self.application = application
def process_request(self, req):
- """
- Called on each request.
+ """Called on each request.
If this returns None, the next application down the stack will be
executed. If it returns a response then that response will be returned
diff --git a/openstack/common/middleware/context.py b/openstack/common/middleware/context.py
index 2636e8e..542e71e 100644
--- a/openstack/common/middleware/context.py
+++ b/openstack/common/middleware/context.py
@@ -30,9 +30,7 @@ class ContextMiddleware(base.Middleware):
super(ContextMiddleware, self).__init__(app)
def make_context(self, *args, **kwargs):
- """
- Create a context with the given arguments.
- """
+ """Create a context with the given arguments."""
# Determine the context class to use
ctxcls = context.RequestContext
@@ -42,7 +40,8 @@ class ContextMiddleware(base.Middleware):
return ctxcls(*args, **kwargs)
def process_request(self, req):
- """
+ """Process the request.
+
Extract any authentication information in the request and
construct an appropriate context from it.
"""
@@ -52,9 +51,7 @@ class ContextMiddleware(base.Middleware):
def filter_factory(global_conf, **local_conf):
- """
- Factory method for paste.deploy
- """
+ """Factory method for paste.deploy."""
conf = global_conf.copy()
conf.update(local_conf)
diff --git a/openstack/common/middleware/debug.py b/openstack/common/middleware/debug.py
index b92af11..f0f6b90 100644
--- a/openstack/common/middleware/debug.py
+++ b/openstack/common/middleware/debug.py
@@ -24,9 +24,10 @@ from openstack.common.middleware import base
class Debug(base.Middleware):
- """
- Helper class that can be inserted into any WSGI application chain
- to get information about the request and response.
+ """Helper class that returns debug information.
+
+ Can be inserted into any WSGI application chain to get information about
+ the request and response.
"""
@webob.dec.wsgify
@@ -48,10 +49,7 @@ class Debug(base.Middleware):
@staticmethod
def print_generator(app_iter):
- """
- Iterator that prints the contents of a wrapper string iterator
- when iterated.
- """
+ """Prints the contents of a wrapper string iterator when iterated."""
print(("*" * 40) + " BODY")
for part in app_iter:
sys.stdout.write(part)
diff --git a/openstack/common/middleware/sizelimit.py b/openstack/common/middleware/sizelimit.py
index 1128b8a..96a1fbf 100644
--- a/openstack/common/middleware/sizelimit.py
+++ b/openstack/common/middleware/sizelimit.py
@@ -41,7 +41,8 @@ CONF.register_opt(max_req_body_size)
class LimitingReader(object):
"""Reader to limit the size of an incoming request."""
def __init__(self, data, limit):
- """
+ """Initiates LimitingReader object.
+
:param data: Underlying data object
:param limit: maximum number of bytes the reader should allow
"""