Fix [H405] pep rule in heat/common
Implements bp docstring-improvements Change-Id: I4e7f5362e73252873872d53aa6984b865bdeb4b4
This commit is contained in:
parent
c75e72324b
commit
d2a9b3f6a7
@ -23,7 +23,8 @@ from heat.common import context
|
||||
|
||||
|
||||
class KeystonePasswordAuthProtocol(object):
|
||||
"""
|
||||
"""Middleware uses username and password to authenticate against Keystone.
|
||||
|
||||
Alternative authentication middleware that uses username and password
|
||||
to authenticate against Keystone instead of validating existing auth token.
|
||||
The benefit being that you no longer require admin/service token to
|
||||
|
@ -14,17 +14,16 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""The code related to integration between oslo.cache module and heat."""
|
||||
|
||||
from oslo_cache import core
|
||||
from oslo_config import cfg
|
||||
|
||||
from heat.common.i18n import _
|
||||
|
||||
"""The module contains the code related to integration between oslo.cache
|
||||
module and heat."""
|
||||
|
||||
|
||||
def register_cache_configurations(conf):
|
||||
"""Register all configurations required for oslo.cache
|
||||
"""Register all configurations required for oslo.cache.
|
||||
|
||||
The procedure registers all configurations required for oslo.cache.
|
||||
It should be called before configuring of cache region
|
||||
|
@ -11,9 +11,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Routines for configuring Heat
|
||||
"""
|
||||
"""Routines for configuring Heat."""
|
||||
import logging as sys_logging
|
||||
import os
|
||||
|
||||
@ -373,18 +371,18 @@ for group, opts in list_opts():
|
||||
|
||||
|
||||
def _get_deployment_flavor():
|
||||
"""
|
||||
Retrieve the paste_deploy.flavor config item, formatted appropriately
|
||||
for appending to the application name.
|
||||
"""Retrieves the paste_deploy.flavor config item.
|
||||
|
||||
Item formatted appropriately for appending to the application name.
|
||||
"""
|
||||
flavor = cfg.CONF.paste_deploy.flavor
|
||||
return '' if not flavor else ('-' + flavor)
|
||||
|
||||
|
||||
def _get_deployment_config_file():
|
||||
"""
|
||||
Retrieve the deployment_config_file config item, formatted as an
|
||||
absolute pathname.
|
||||
"""Retrieves the deployment_config_file config item.
|
||||
|
||||
Item formatted as an absolute pathname.
|
||||
"""
|
||||
config_path = cfg.CONF.find_file(
|
||||
cfg.CONF.paste_deploy['api_paste_config'])
|
||||
@ -395,8 +393,7 @@ def _get_deployment_config_file():
|
||||
|
||||
|
||||
def load_paste_app(app_name=None):
|
||||
"""
|
||||
Builds and returns a WSGI app from a paste config file.
|
||||
"""Builds and returns a WSGI app from a paste config file.
|
||||
|
||||
We assume the last config file specified in the supplied ConfigOpts
|
||||
object is the paste config file.
|
||||
|
@ -39,9 +39,10 @@ auth.register_conf_options(cfg.CONF, TRUSTEE_CONF_GROUP)
|
||||
|
||||
|
||||
class RequestContext(context.RequestContext):
|
||||
"""
|
||||
Stores information about the security context under which the user
|
||||
accesses the system, as well as additional request information.
|
||||
"""Stores information about the security context.
|
||||
|
||||
Under the security context the user accesses the system, as well as
|
||||
additional request information.
|
||||
"""
|
||||
|
||||
def __init__(self, auth_token=None, username=None, password=None,
|
||||
@ -51,7 +52,8 @@ class RequestContext(context.RequestContext):
|
||||
overwrite=True, trust_id=None, trustor_user_id=None,
|
||||
request_id=None, auth_token_info=None, region_name=None,
|
||||
auth_plugin=None, trusts_auth_plugin=None, **kwargs):
|
||||
"""
|
||||
"""Initialisation of the request context.
|
||||
|
||||
:param overwrite: Set to False to ensure that the greenthread local
|
||||
copy of the index is not overwritten.
|
||||
|
||||
@ -220,15 +222,14 @@ class ContextMiddleware(wsgi.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."""
|
||||
return self.ctxcls(*args, **kwargs)
|
||||
|
||||
def process_request(self, req):
|
||||
"""
|
||||
Extract any authentication information in the request and
|
||||
construct an appropriate context from it.
|
||||
"""Constructs an appropriate context from extracted auth information.
|
||||
|
||||
Extract any authentication information in the request and construct an
|
||||
appropriate context from it.
|
||||
"""
|
||||
headers = req.headers
|
||||
environ = req.environ
|
||||
@ -275,9 +276,7 @@ class ContextMiddleware(wsgi.Middleware):
|
||||
|
||||
|
||||
def ContextMiddleware_filter_factory(global_conf, **local_conf):
|
||||
"""
|
||||
Factory method for paste.deploy
|
||||
"""
|
||||
"""Factory method for paste.deploy."""
|
||||
conf = global_conf.copy()
|
||||
conf.update(local_conf)
|
||||
|
||||
|
@ -78,8 +78,8 @@ def get_valid_encryption_key(encryption_key, fix_length=False):
|
||||
|
||||
|
||||
def heat_decrypt(value, encryption_key=None):
|
||||
"""Decrypt function for data that has been encrypted using an older
|
||||
version of Heat.
|
||||
"""Decrypt data that has been encrypted using an older version of Heat.
|
||||
|
||||
Note: the encrypt function returns the function that is needed to
|
||||
decrypt the data. The database then stores this. When the data is
|
||||
then retrieved (potentially by a later version of Heat) the decrypt
|
||||
|
@ -14,9 +14,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
"""
|
||||
Middleware for authenticating against custom backends.
|
||||
"""
|
||||
"""Middleware for authenticating against custom backends."""
|
||||
|
||||
from oslo_context import context
|
||||
from oslo_log import log as logging
|
||||
@ -35,8 +33,7 @@ class AuthProtocol(object):
|
||||
self.rpc_client = rpc_client.EngineClient()
|
||||
|
||||
def __call__(self, env, start_response):
|
||||
"""
|
||||
Handle incoming request.
|
||||
"""Handle incoming request.
|
||||
|
||||
Authenticate send downstream on success. Reject request if
|
||||
we can't authenticate.
|
||||
@ -50,8 +47,7 @@ class AuthProtocol(object):
|
||||
return self._reject_request(env, start_response)
|
||||
|
||||
def _reject_request(self, env, start_response):
|
||||
"""
|
||||
Redirect client to auth server.
|
||||
"""Redirect client to auth server.
|
||||
|
||||
:param env: wsgi request environment
|
||||
:param start_response: wsgi response callback
|
||||
|
@ -48,12 +48,11 @@ class KeystoneError(Exception):
|
||||
|
||||
@six.python_2_unicode_compatible
|
||||
class HeatException(Exception):
|
||||
"""Base Heat Exception
|
||||
|
||||
To correctly use this class, inherit from it and define
|
||||
a 'msg_fmt' property. That msg_fmt will get printf'd
|
||||
with the keyword arguments provided to the constructor.
|
||||
"""Base Heat Exception.
|
||||
|
||||
To correctly use this class, inherit from it and define a 'msg_fmt'
|
||||
property. That msg_fmt will get printf'd with the keyword arguments
|
||||
provided to the constructor.
|
||||
"""
|
||||
message = _("An unknown exception occurred.")
|
||||
|
||||
@ -389,7 +388,7 @@ class PropertyUnspecifiedError(HeatException):
|
||||
|
||||
|
||||
class UpdateReplace(Exception):
|
||||
'''Raised when resource update requires replacement.'''
|
||||
"""Raised when resource update requires replacement."""
|
||||
def __init__(self, resource_name='Unknown'):
|
||||
msg = _("The Resource %s requires replacement.") % resource_name
|
||||
super(Exception, self).__init__(six.text_type(msg))
|
||||
@ -421,8 +420,9 @@ class UpdateInProgress(Exception):
|
||||
|
||||
|
||||
class HTTPExceptionDisguise(Exception):
|
||||
"""Disguises HTTP exceptions so they can be handled by the webob fault
|
||||
application in the wsgi pipeline.
|
||||
"""Disguises HTTP exceptions.
|
||||
|
||||
They can be handled by the webob fault application in the wsgi pipeline.
|
||||
"""
|
||||
|
||||
def __init__(self, exception):
|
||||
|
@ -60,6 +60,7 @@ def get_member_refids(group, exclude=None):
|
||||
|
||||
def get_member_names(group):
|
||||
"""Get a list of resource names of the resources in the specified group.
|
||||
|
||||
Failed resources will be ignored.
|
||||
"""
|
||||
return [r.name for r in get_members(group)]
|
||||
|
@ -46,7 +46,6 @@ cfg.CONF.register_opts(keystone_opts)
|
||||
|
||||
|
||||
class KeystoneClientV3(object):
|
||||
|
||||
"""Wrap keystone client so we can encapsulate logic used in resources.
|
||||
|
||||
Note this is intended to be initialized from a resource on a per-session
|
||||
@ -100,7 +99,7 @@ class KeystoneClientV3(object):
|
||||
def stack_domain(self):
|
||||
"""Domain scope data.
|
||||
|
||||
This is only used for checking for scoping data, not using the value
|
||||
This is only used for checking for scoping data, not using the value.
|
||||
"""
|
||||
return self._stack_domain_id or self.stack_domain_name
|
||||
|
||||
@ -557,7 +556,6 @@ class KeystoneClientV3(object):
|
||||
|
||||
|
||||
class KeystoneClient(object):
|
||||
|
||||
"""Keystone Auth Client.
|
||||
|
||||
Delay choosing the backend client module until the client's class
|
||||
|
@ -162,7 +162,6 @@ class HeatIdentifier(collections.Mapping):
|
||||
|
||||
|
||||
class ResourceIdentifier(HeatIdentifier):
|
||||
|
||||
"""An identifier for a resource."""
|
||||
|
||||
RESOURCE_NAME = 'resource_name'
|
||||
@ -198,7 +197,6 @@ class ResourceIdentifier(HeatIdentifier):
|
||||
|
||||
|
||||
class EventIdentifier(HeatIdentifier):
|
||||
|
||||
"""An identifier for an event."""
|
||||
|
||||
(RESOURCE_NAME, EVENT_ID) = (ResourceIdentifier.RESOURCE_NAME, 'event_id')
|
||||
|
@ -12,9 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
'''
|
||||
Utility for fetching and running plug point implementation classes
|
||||
'''
|
||||
"""Utility for fetching and running plug point implementation classes."""
|
||||
|
||||
from oslo_log import log as logging
|
||||
|
||||
@ -27,14 +25,15 @@ pp_class_instances = None
|
||||
|
||||
|
||||
def get_plug_point_class_instances():
|
||||
'''
|
||||
"""Instances of classes that implements pre/post stack operation methods.
|
||||
|
||||
Get list of instances of classes that (may) implement pre and post
|
||||
stack operation methods.
|
||||
|
||||
The list of class instances is sorted using get_ordinal methods
|
||||
on the plug point classes. If class1.ordinal() < class2.ordinal(),
|
||||
then class1 will be before before class2 in the list.
|
||||
'''
|
||||
"""
|
||||
global pp_class_instances
|
||||
if pp_class_instances is None:
|
||||
pp_class_instances = []
|
||||
@ -60,13 +59,14 @@ def get_plug_point_class_instances():
|
||||
|
||||
|
||||
def do_pre_ops(cnxt, stack, current_stack=None, action=None):
|
||||
'''
|
||||
Call available pre-op methods sequentially, in order determined with
|
||||
get_ordinal(), with parameters context, stack, current_stack, action
|
||||
"""Call available pre-op methods sequentially.
|
||||
|
||||
In order determined with get_ordinal(), with parameters context, stack,
|
||||
current_stack, action.
|
||||
|
||||
On failure of any pre_op method, will call post-op methods corresponding
|
||||
to successful calls of pre-op methods
|
||||
'''
|
||||
to successful calls of pre-op methods.
|
||||
"""
|
||||
cinstances = get_plug_point_class_instances()
|
||||
if action is None:
|
||||
action = stack.action
|
||||
@ -82,11 +82,11 @@ def do_pre_ops(cnxt, stack, current_stack=None, action=None):
|
||||
|
||||
def do_post_ops(cnxt, stack, current_stack=None, action=None,
|
||||
is_stack_failure=False):
|
||||
'''
|
||||
Call available post-op methods sequentially, in order determined with
|
||||
get_ordinal(), with parameters context, stack, current_stack,
|
||||
action, is_stack_failure
|
||||
'''
|
||||
"""Call available post-op methods sequentially.
|
||||
|
||||
In order determined with get_ordinal(), with parameters context, stack,
|
||||
current_stack, action, is_stack_failure.
|
||||
"""
|
||||
cinstances = get_plug_point_class_instances()
|
||||
if action is None:
|
||||
action = stack.action
|
||||
|
@ -17,10 +17,10 @@ from heat.common.i18n import _
|
||||
|
||||
|
||||
def extract_bool(name, value):
|
||||
'''
|
||||
Convert any true/false string to its corresponding boolean value,
|
||||
regardless of case.
|
||||
'''
|
||||
"""Convert any true/false string to its corresponding boolean value.
|
||||
|
||||
Value is case insensitive.
|
||||
"""
|
||||
if str(value).lower() not in ('true', 'false'):
|
||||
raise ValueError(_('Unrecognized value "%(value)s" for "%(name)s", '
|
||||
'acceptable values are: true, false.')
|
||||
|
@ -15,7 +15,7 @@
|
||||
# under the License.
|
||||
|
||||
# Based on glance/api/policy.py
|
||||
"""Policy Engine For Heat"""
|
||||
"""Policy Engine For Heat."""
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
@ -80,7 +80,7 @@ class Enforcer(object):
|
||||
return self._check(context, _action, _target, self.exc, action=action)
|
||||
|
||||
def check_is_admin(self, context):
|
||||
"""Whether or not roles contains 'admin' role according to policy.json
|
||||
"""Whether or not roles contains 'admin' role according to policy.json.
|
||||
|
||||
:param context: Heat request context
|
||||
:returns: A non-False value if the user is admin according to policy
|
||||
|
@ -16,9 +16,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Utility methods for serializing responses
|
||||
"""
|
||||
"""Utility methods for serializing responses."""
|
||||
|
||||
import datetime
|
||||
|
||||
|
@ -11,9 +11,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Utilities for handling ISO 8601 duration format.
|
||||
"""
|
||||
"""Utilities for handling ISO 8601 duration format."""
|
||||
|
||||
import datetime
|
||||
import random
|
||||
@ -28,13 +26,12 @@ wallclock = time.time
|
||||
|
||||
|
||||
class Duration(object):
|
||||
'''
|
||||
Note that we don't attempt to handle leap seconds or large clock
|
||||
jumps here. The latter are assumed to be rare and the former
|
||||
negligible in the context of the timeout. Time zone adjustments,
|
||||
Daylight Savings and the like *are* handled. PEP 418 adds a proper
|
||||
monotonic clock, but only in Python 3.3.
|
||||
'''
|
||||
# (NOTE): we don't attempt to handle leap seconds or large clock
|
||||
# jumps here. The latter are assumed to be rare and the former
|
||||
# negligible in the context of the timeout. Time zone adjustments,
|
||||
# Daylight Savings and the like *are* handled. PEP 418 adds a proper
|
||||
# monotonic clock, but only in Python 3.3.
|
||||
|
||||
def __init__(self, timeout=0):
|
||||
self._endtime = wallclock() + timeout
|
||||
|
||||
@ -46,8 +43,7 @@ class Duration(object):
|
||||
|
||||
|
||||
def parse_isoduration(duration):
|
||||
"""
|
||||
Convert duration in ISO 8601 format to second(s).
|
||||
"""Convert duration in ISO 8601 format to second(s).
|
||||
|
||||
Year, Month, Week, and Day designators are not supported.
|
||||
Example: 'PT12H30M5S'
|
||||
@ -66,8 +62,7 @@ def parse_isoduration(duration):
|
||||
|
||||
|
||||
def retry_backoff_delay(attempt, scale_factor=1.0, jitter_max=0.0):
|
||||
"""
|
||||
Calculate an exponential backoff delay with jitter.
|
||||
"""Calculate an exponential backoff delay with jitter.
|
||||
|
||||
Delay is calculated as
|
||||
2^attempt + (uniform random from [0,1) * jitter_max)
|
||||
|
@ -16,9 +16,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Utility methods for working with WSGI servers
|
||||
"""
|
||||
"""Utility methods for working with WSGI servers."""
|
||||
|
||||
import abc
|
||||
import errno
|
||||
@ -209,10 +207,9 @@ def get_bind_addr(conf, default_port=None):
|
||||
|
||||
|
||||
def get_socket(conf, default_port):
|
||||
"""
|
||||
Bind socket to bind ip:port in conf
|
||||
"""Bind socket to bind ip:port in conf.
|
||||
|
||||
note: Mostly comes from Swift with a few small changes...
|
||||
Note: Mostly comes from Swift with a few small changes...
|
||||
|
||||
:param conf: a cfg.ConfigOpts object
|
||||
:param default_port: port to bind to if none is specified in conf
|
||||
@ -295,16 +292,13 @@ class Server(object):
|
||||
os.killpg(0, signal.SIGTERM)
|
||||
|
||||
def hup(self, *args):
|
||||
"""
|
||||
Reloads configuration files with zero down time.
|
||||
"""
|
||||
"""Reloads configuration files with zero down time."""
|
||||
LOG.error(_LE('SIGHUP received'))
|
||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
raise exception.SIGHUPInterrupt
|
||||
|
||||
def start(self, application, default_port):
|
||||
"""
|
||||
Run a WSGI server with the given application.
|
||||
"""Run a WSGI server with the given application.
|
||||
|
||||
:param application: The application to run in the WSGI server
|
||||
:param default_port: Port to bind to if none is specified in conf
|
||||
@ -352,8 +346,7 @@ class Server(object):
|
||||
LOG.debug('Exited')
|
||||
|
||||
def configure_socket(self, old_conf=None, has_changed=None):
|
||||
"""
|
||||
Ensure a socket exists and is appropriately configured.
|
||||
"""Ensure a socket exists and is appropriately configured.
|
||||
|
||||
This function is called on start up, and can also be
|
||||
called in the event of a configuration reload.
|
||||
@ -448,10 +441,10 @@ class Server(object):
|
||||
self.run_child()
|
||||
|
||||
def stash_conf_values(self):
|
||||
"""
|
||||
Make a copy of some of the current global CONF's settings.
|
||||
Allows determining if any of these values have changed
|
||||
when the config is reloaded.
|
||||
"""Make a copy of some of the current global CONF's settings.
|
||||
|
||||
Allows determining if any of these values have changed when the config
|
||||
is reloaded.
|
||||
"""
|
||||
conf = {}
|
||||
conf['bind_host'] = self.conf.bind_host
|
||||
@ -462,8 +455,7 @@ class Server(object):
|
||||
return conf
|
||||
|
||||
def reload(self):
|
||||
"""
|
||||
Reload and re-apply configuration settings
|
||||
"""Reload and re-apply configuration settings.
|
||||
|
||||
Existing child processes are sent a SIGHUP signal
|
||||
and will exit after completing existing requests.
|
||||
@ -560,24 +552,22 @@ class Server(object):
|
||||
|
||||
|
||||
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.
|
||||
"""
|
||||
|
||||
def __init__(self, application):
|
||||
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
|
||||
and execution will stop here.
|
||||
|
||||
"""
|
||||
return None
|
||||
|
||||
@ -595,7 +585,8 @@ class Middleware(object):
|
||||
|
||||
|
||||
class Debug(Middleware):
|
||||
"""
|
||||
"""Helper class to get information about the request and response.
|
||||
|
||||
Helper class that can be inserted into any WSGI application chain
|
||||
to get information about the request and response.
|
||||
"""
|
||||
@ -619,10 +610,7 @@ class Debug(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)
|
||||
@ -636,35 +624,34 @@ def debug_filter(app, conf, **local_conf):
|
||||
|
||||
|
||||
class DefaultMethodController(object):
|
||||
"""
|
||||
This controller handles the OPTIONS request method and any of the
|
||||
HTTP methods that are not explicitly implemented by the application.
|
||||
"""Controller that handles the OPTIONS request method.
|
||||
|
||||
This controller handles the OPTIONS request method and any of the HTTP
|
||||
methods that are not explicitly implemented by the application.
|
||||
"""
|
||||
def options(self, req, allowed_methods, *args, **kwargs):
|
||||
"""
|
||||
"""Return a response that includes the 'Allow' header.
|
||||
|
||||
Return a response that includes the 'Allow' header listing the methods
|
||||
that are implemented. A 204 status code is used for this response.
|
||||
"""
|
||||
raise webob.exc.HTTPNoContent(headers=[('Allow', allowed_methods)])
|
||||
|
||||
def reject(self, req, allowed_methods, *args, **kwargs):
|
||||
"""
|
||||
Return a 405 method not allowed error. As a convenience, the 'Allow'
|
||||
header with the list of implemented methods is included in the
|
||||
response as well.
|
||||
"""Return a 405 method not allowed error.
|
||||
|
||||
As a convenience, the 'Allow' header with the list of implemented
|
||||
methods is included in the response as well.
|
||||
"""
|
||||
raise webob.exc.HTTPMethodNotAllowed(
|
||||
headers=[('Allow', allowed_methods)])
|
||||
|
||||
|
||||
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
|
||||
@ -692,8 +679,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
|
||||
@ -701,10 +688,11 @@ class Router(object):
|
||||
@staticmethod
|
||||
@webob.dec.wsgify
|
||||
def _dispatch(req):
|
||||
"""
|
||||
"""Returns controller after matching the incoming request to a route.
|
||||
|
||||
Called by self._router after matching the incoming request to a route
|
||||
and putting the information into req.environ. Either returns 404
|
||||
or the routed WSGI app's response.
|
||||
and putting the information into req.environ. Either returns 404 or the
|
||||
routed WSGI app's response.
|
||||
"""
|
||||
match = req.environ['wsgiorg.routing_args'][1]
|
||||
if not match:
|
||||
@ -768,8 +756,7 @@ def is_json_content_type(request):
|
||||
|
||||
class JSONRequestDeserializer(object):
|
||||
def has_body(self, request):
|
||||
"""
|
||||
Returns whether a Webob.Request object will possess an entity body.
|
||||
"""Returns whether a Webob.Request object will possess an entity body.
|
||||
|
||||
:param request: Webob.Request object
|
||||
"""
|
||||
@ -799,8 +786,7 @@ class JSONRequestDeserializer(object):
|
||||
|
||||
|
||||
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,
|
||||
@ -816,7 +802,8 @@ class Resource(object):
|
||||
serialized by requested content type.
|
||||
"""
|
||||
def __init__(self, controller, deserializer, serializer=None):
|
||||
"""
|
||||
"""Initialisation of the WSGI app.
|
||||
|
||||
:param controller: object that implement methods created by routes lib
|
||||
:param deserializer: object that supports webob request deserialization
|
||||
through controller-like actions
|
||||
@ -968,7 +955,6 @@ def translate_exception(exc, locale):
|
||||
|
||||
@six.add_metaclass(abc.ABCMeta)
|
||||
class BasePasteFactory(object):
|
||||
|
||||
"""A base class for paste app and filter factories.
|
||||
|
||||
Sub-classes must override the KEY class attribute and provide
|
||||
@ -1006,7 +992,6 @@ class BasePasteFactory(object):
|
||||
|
||||
|
||||
class AppFactory(BasePasteFactory):
|
||||
|
||||
"""A Generic paste.deploy app factory.
|
||||
|
||||
This requires heat.app_factory to be set to a callable which returns a
|
||||
@ -1029,7 +1014,6 @@ class AppFactory(BasePasteFactory):
|
||||
|
||||
|
||||
class FilterFactory(AppFactory):
|
||||
|
||||
"""A Generic paste.deploy filter factory.
|
||||
|
||||
This requires heat.filter_factory to be set to a callable which returns a
|
||||
|
Loading…
Reference in New Issue
Block a user