diff options
Diffstat (limited to 'cherrypy/_cpconfig.py')
-rw-r--r-- | cherrypy/_cpconfig.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/cherrypy/_cpconfig.py b/cherrypy/_cpconfig.py index 7afb9131..674199f4 100644 --- a/cherrypy/_cpconfig.py +++ b/cherrypy/_cpconfig.py @@ -139,9 +139,9 @@ def merge(base, other): for section, value_map in reprconf.as_dict(other).items(): if not isinstance(value_map, dict): raise ValueError( - "Application config must include section headers, but the " + 'Application config must include section headers, but the ' "config you tried to merge doesn't have any sections. " - "Wrap your config in another dict with paths as section " + 'Wrap your config in another dict with paths as section ' "headers, for example: {'/': config}.") base.setdefault(section, {}).update(value_map) @@ -159,12 +159,12 @@ class Config(reprconf.Config): def _apply(self, config): """Update self from a dict.""" - if isinstance(config.get("global"), dict): + if isinstance(config.get('global'), dict): if len(config) > 1: cherrypy.checker.global_config_contained_paths = True - config = config["global"] + config = config['global'] if 'tools.staticdir.dir' in config: - config['tools.staticdir.section'] = "global" + config['tools.staticdir.section'] = 'global' reprconf.Config._apply(self, config) @staticmethod @@ -172,8 +172,8 @@ class Config(reprconf.Config): """Decorator for page handlers to set _cp_config.""" if args: raise TypeError( - "The cherrypy.config decorator does not accept positional " - "arguments; you must use keyword arguments.") + 'The cherrypy.config decorator does not accept positional ' + 'arguments; you must use keyword arguments.') def tool_decorator(f): _Vars(f).setdefault('_cp_config', {}).update(kwargs) @@ -197,14 +197,14 @@ class _Vars(object): # Sphinx begin config.environments Config.environments = environments = { - "staging": { + 'staging': { 'engine.autoreload.on': False, 'checker.on': False, 'tools.log_headers.on': False, 'request.show_tracebacks': False, 'request.show_mismatched_params': False, }, - "production": { + 'production': { 'engine.autoreload.on': False, 'checker.on': False, 'tools.log_headers.on': False, @@ -212,7 +212,7 @@ Config.environments = environments = { 'request.show_mismatched_params': False, 'log.screen': False, }, - "embedded": { + 'embedded': { # For use with CherryPy embedded in another deployment stack. 'engine.autoreload.on': False, 'checker.on': False, @@ -223,7 +223,7 @@ Config.environments = environments = { 'engine.SIGHUP': None, 'engine.SIGTERM': None, }, - "test_suite": { + 'test_suite': { 'engine.autoreload.on': False, 'checker.on': False, 'tools.log_headers.on': False, @@ -237,11 +237,11 @@ Config.environments = environments = { def _server_namespace_handler(k, v): """Config handler for the "server" namespace.""" - atoms = k.split(".", 1) + atoms = k.split('.', 1) if len(atoms) > 1: # Special-case config keys of the form 'server.servername.socket_port' # to configure additional HTTP servers. - if not hasattr(cherrypy, "servers"): + if not hasattr(cherrypy, 'servers'): cherrypy.servers = {} servername, k = atoms @@ -260,7 +260,7 @@ def _server_namespace_handler(k, v): setattr(cherrypy.servers[servername], k, v) else: setattr(cherrypy.server, k, v) -Config.namespaces["server"] = _server_namespace_handler +Config.namespaces['server'] = _server_namespace_handler def _engine_namespace_handler(k, v): @@ -271,8 +271,8 @@ def _engine_namespace_handler(k, v): engine.subscribe('SIGHUP', v) elif k == 'SIGTERM': engine.subscribe('SIGTERM', v) - elif "." in k: - plugin, attrname = k.split(".", 1) + elif '.' in k: + plugin, attrname = k.split('.', 1) plugin = getattr(engine, plugin) if attrname == 'on': if v and hasattr(getattr(plugin, 'subscribe', None), '__call__'): @@ -287,7 +287,7 @@ def _engine_namespace_handler(k, v): setattr(plugin, attrname, v) else: setattr(engine, k, v) -Config.namespaces["engine"] = _engine_namespace_handler +Config.namespaces['engine'] = _engine_namespace_handler def _tree_namespace_handler(k, v): @@ -295,9 +295,9 @@ def _tree_namespace_handler(k, v): if isinstance(v, dict): for script_name, app in v.items(): cherrypy.tree.graft(app, script_name) - msg = "Mounted: %s on %s" % (app, script_name or "/") + msg = 'Mounted: %s on %s' % (app, script_name or '/') cherrypy.engine.log(msg) else: cherrypy.tree.graft(v, v.script_name) - cherrypy.engine.log("Mounted: %s on %s" % (v, v.script_name or "/")) -Config.namespaces["tree"] = _tree_namespace_handler + cherrypy.engine.log('Mounted: %s on %s' % (v, v.script_name or '/')) +Config.namespaces['tree'] = _tree_namespace_handler |