diff options
Diffstat (limited to 'openstack/common/deprecated/wsgi.py')
-rw-r--r-- | openstack/common/deprecated/wsgi.py | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/openstack/common/deprecated/wsgi.py b/openstack/common/deprecated/wsgi.py index f9be97e..cf2e9ae 100644 --- a/openstack/common/deprecated/wsgi.py +++ b/openstack/common/deprecated/wsgi.py @@ -66,8 +66,7 @@ def run_server(application, port, **kwargs): class Service(service.Service): - """ - Provides a Service API for wsgi servers. + """Provides a Service API for wsgi servers. This gives us the ability to launch wsgi servers with the Launcher classes in service.py. @@ -163,13 +162,10 @@ class Service(service.Service): class Router(object): - """ - WSGI middleware that maps incoming requests to WSGI apps. - """ + """WSGI middleware that maps incoming requests to WSGI apps.""" def __init__(self, mapper): - """ - Create a router for the given routes.Mapper. + """Create a router for the given routes.Mapper. Each route in `mapper` must specify a 'controller', which is a WSGI app to call. You'll probably want to specify an 'action' as @@ -197,8 +193,8 @@ class Router(object): @webob.dec.wsgify def __call__(self, req): - """ - Route the incoming request to a controller based on self.map. + """Route the incoming request to a controller based on self.map. + If no match, return a 404. """ return self._router @@ -206,9 +202,10 @@ class Router(object): @staticmethod @webob.dec.wsgify def _dispatch(req): - """ + """Gets application from the environment. + Called by self._router after matching the incoming request to a route - and putting the information into req.environ. Either returns 404 + and putting the information into req.environ. Either returns 404 or the routed WSGI app's response. """ match = req.environ['wsgiorg.routing_args'][1] @@ -263,8 +260,7 @@ class Request(webob.Request): class Resource(object): - """ - WSGI app that handles (de)serialization and controller dispatch. + """WSGI app that handles (de)serialization and controller dispatch. Reads routing information supplied by RoutesMiddleware and calls the requested action method upon its deserializer, controller, @@ -280,7 +276,8 @@ class Resource(object): serialized by requested content type. """ def __init__(self, controller, deserializer=None, serializer=None): - """ + """Initiates Resource object. + :param controller: object that implement methods created by routes lib :param deserializer: object that supports webob request deserialization through controller-like actions @@ -387,7 +384,8 @@ class JSONDictSerializer(DictSerializer): class XMLDictSerializer(DictSerializer): def __init__(self, metadata=None, xmlns=None): - """ + """Initiates XMLDictSerializer object. + :param metadata: information needed to deserialize xml into a dictionary. :param xmlns: XML namespace to include with serialized xml @@ -662,7 +660,8 @@ class JSONDeserializer(TextDeserializer): class XMLDeserializer(TextDeserializer): def __init__(self, metadata=None): - """ + """Initiates XMLDeserializer object. + :param metadata: information needed to deserialize xml into a dictionary. """ |