Commits

Robert Brewer committed a802f42

Changed every instance of 'conf' in the API to 'config'.

  • Participants
  • Parent commits 6f4be47

Comments (0)

Files changed (10)

cherrypy/__init__.py

 from cherrypy import _cpserver
 server = _cpserver.Server()
 
-def quickstart(root, script_name="", conf=None):
+def quickstart(root, script_name="", config=None):
     """Mount the given app, start the engine and builtin server, then block."""
-    tree.mount(root, script_name, conf)
+    tree.mount(root, script_name, config)
     server.quickstart()
     engine.start()
 

cherrypy/_cpconfig.py

     cherrypy.config.
     
     Application: entries which apply to each mounted application are stored
-    on the Application object itself, as 'app.conf'. This is a two-level
+    on the Application object itself, as 'app.config'. This is a two-level
     dict where each key is a path, or "relative URL" (for example, "/" or
     "/path/to/my/page"), and each value is a config dict. Usually, this
-    data is provided in the call to cherrypy.tree.mount(root(), conf=conf),
+    data is provided in the call to cherrypy.tree.mount(root(), config=conf),
     although you may also use app.merge(conf).
     
     Request: each Request object possesses a single 'Request.config' dict.
         self.clear()
         dict.update(self, self.defaults)
     
-    def update(self, conf):
+    def update(self, config):
         """Update self from a dict, file or filename."""
-        if isinstance(conf, basestring):
+        if isinstance(config, basestring):
             # Filename
-            if conf not in cherrypy.engine.reload_files:
-                cherrypy.engine.reload_files.append(conf)
-            conf = _Parser().dict_from_file(conf)
-        elif hasattr(conf, 'read'):
+            if config not in cherrypy.engine.reload_files:
+                cherrypy.engine.reload_files.append(config)
+            config = _Parser().dict_from_file(config)
+        elif hasattr(config, 'read'):
             # Open file object
-            conf = _Parser().dict_from_file(conf)
+            config = _Parser().dict_from_file(config)
         else:
-            conf = conf.copy()
+            config = config.copy()
         
-        if isinstance(conf.get("global", None), dict):
-            conf = conf["global"]
+        if isinstance(config.get("global", None), dict):
+            config = config["global"]
         
-        if 'environment' in conf:
-            env = environments[conf['environment']]
+        if 'environment' in config:
+            env = environments[config['environment']]
             for k in env:
-                if k not in conf:
-                    conf[k] = env[k]
+                if k not in config:
+                    config[k] = env[k]
         
-        if 'tools.staticdir.dir' in conf:
-            conf['tools.staticdir.section'] = "global"
+        if 'tools.staticdir.dir' in config:
+            config['tools.staticdir.section'] = "global"
         
         # Must use this idiom in order to hit our custom __setitem__.
-        for k, v in conf.iteritems():
+        for k, v in config.iteritems():
             self[k] = v
     
     def __setitem__(self, k, v):

cherrypy/_cprequest.py

         nodeconf = {}
         if hasattr(root, "_cp_config"):
             nodeconf.update(root._cp_config)
-        if "/" in app.conf:
-            nodeconf.update(app.conf["/"])
+        if "/" in app.config:
+            nodeconf.update(app.config["/"])
         object_trail = [('root', root, nodeconf, curpath)]
         
         node = root
                 if hasattr(node, "_cp_config"):
                     nodeconf.update(node._cp_config)
             
-            # Mix in values from app.conf for this path.
+            # Mix in values from app.config for this path.
             curpath = "/".join((curpath, name))
-            if curpath in app.conf:
-                nodeconf.update(app.conf[curpath])
+            if curpath in app.config:
+                nodeconf.update(app.config[curpath])
             
             object_trail.append((objname, node, nodeconf, curpath))
         
         """Find and call a dispatcher (which sets self.handler and .config)."""
         dispatch = self.dispatch
         # First, see if there is a custom dispatch at this URI. Custom
-        # dispatchers can only be specified in app.conf, not in _cp_config
+        # dispatchers can only be specified in app.config, not in _cp_config
         # (since custom dispatchers may not even have an app.root).
         trail = path
         while trail:
-            nodeconf = self.app.conf.get(trail, {})
+            nodeconf = self.app.config.get(trail, {})
             d = nodeconf.get("request.dispatch")
             if d:
                 dispatch = d

cherrypy/_cptools.py

     """Session Tool for CherryPy."""
     
     def _setup(self):
-        """Hook this tool into cherrypy.request using the given conf.
+        """Hook this tool into cherrypy.request.
         
         The standard CherryPy request object will automatically call this
         method when the tool is "turned on" in config.
     """
     
     def _setup(self):
-        """Hook this tool into cherrypy.request using the given conf."""
+        """Hook this tool into cherrypy.request."""
         request = cherrypy.request
         # Guard against running this method twice.
         if hasattr(request, 'xmlrpc'):
             request.hooks.attach('before_finalize', _caching.tee_output)
     
     def _setup(self):
-        """Hook caching into cherrypy.request using the given conf."""
+        """Hook caching into cherrypy.request."""
         conf = self._merged_args()
         cherrypy.request.hooks.attach('before_main', self._wrapper, **conf)
 

cherrypy/_cptree.py

         by a "page1" method on the root object. If script_name is
         explicitly set to None, then CherryPy will attempt to provide
         it each time from request.wsgi_environ['SCRIPT_NAME'].
-    conf: a dict of {path: pathconf} pairs, where 'pathconf' is itself
+    config: a dict of {path: pathconf} pairs, where 'pathconf' is itself
         a dict of {key: value} pairs.
     """
     
         self.script_name = script_name
         self.namespaces = {"log": lambda k, v: setattr(self.log, k, v),
                            }
-        self.conf = {}
+        self.config = {}
     
     def _get_script_name(self):
         if self._script_name is None:
         self._script_name = value
     script_name = property(fget=_get_script_name, fset=_set_script_name)
     
-    def merge(self, conf):
+    def merge(self, config):
         """Merge the given config into self.config."""
-        _cpconfig.merge(self.conf, conf)
+        _cpconfig.merge(self.config, config)
         
         # Handle namespaces specified in config.
-        rootconf = self.conf.get("/", {})
+        rootconf = self.config.get("/", {})
         for k, v in rootconf.iteritems():
             atoms = k.split(".", 1)
             namespace = atoms[0]
     def __init__(self):
         self.apps = {}
     
-    def mount(self, root, script_name="", conf=None):
-        """Mount a new app from a root object, script_name, and conf."""
+    def mount(self, root, script_name="", config=None):
+        """Mount a new app from a root object, script_name, and config."""
         # Next line both 1) strips trailing slash and 2) maps "/" -> "".
         script_name = script_name.rstrip("/")
         
                                        "favicon.ico")
                 root.favicon_ico = tools.staticfile.handler(favicon)
         
-        if conf:
-            app.merge(conf)
+        if config:
+            app.merge(config)
         
         self.apps[script_name] = app
         

cherrypy/test/test_core.py

         '/': {'log.access_file': log_access_file},
         '/method': {'request.methods_with_bodies': ("POST", "PUT", "PROPFIND")},
         }
-    cherrypy.tree.mount(root, conf=appconf)
+    cherrypy.tree.mount(root, config=appconf)
 
 
 #                             Client-side code                             #

cherrypy/test/test_etags.py

     
     conf = {'/': {'tools.etags.on': True,
                   'tools.etags.autotags': True}}
-    cherrypy.tree.mount(Root(), conf=conf)
+    cherrypy.tree.mount(Root(), config=conf)
     cherrypy.config.update({'environment': 'test_suite'})
 
 from cherrypy.test import helper

cherrypy/test/test_static.py

         },
         }
     
-    cherrypy.tree.mount(root, conf=conf)
+    cherrypy.tree.mount(root, config=conf)
     cherrypy.config.update({'environment': 'test_suite'})
 
 from cherrypy.test import helper

cherrypy/test/test_tools.py

             'tools.encode.on': True,
         },
     }
-    cherrypy.tree.mount(root, conf=conf)
+    cherrypy.tree.mount(root, config=conf)
 
 
 #                             Client-side code                             #

cherrypy/test/test_wsgi_ns.py

     app = cherrypy.Application(Root())
     p = cherrypy.wsgi.pipeline(app, [('changecase', ChangeCase)])
     p.config['changecase'] = {'to': 'upper'}
-    cherrypy.tree.mount(app, conf={'/': root_conf})
+    cherrypy.tree.mount(app, config={'/': root_conf})
     
     # If we do not supply any middleware in code, pipeline is much cleaner:
     # app = cherrypy.Application(Root())
     # cherrypy.wsgi.pipeline(app)
-    # cherrypy.tree.mount(app, conf={'/': root_conf})
+    # cherrypy.tree.mount(app, config={'/': root_conf})
 
 
 from cherrypy.test import helper