Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1311

Show
Ignore:
Timestamp:
09/02/06 02:25:29
Author:
fumanchu
Message:

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

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/__init__.py

    r1309 r1311  
    2222server = _cpserver.Server() 
    2323 
    24 def quickstart(root, script_name="", conf=None): 
     24def quickstart(root, script_name="", config=None): 
    2525    """Mount the given app, start the engine and builtin server, then block.""" 
    26     tree.mount(root, script_name, conf
     26    tree.mount(root, script_name, config
    2727    server.quickstart() 
    2828    engine.start() 
  • trunk/cherrypy/_cpconfig.py

    r1299 r1311  
    1515     
    1616    Application: entries which apply to each mounted application are stored 
    17     on the Application object itself, as 'app.conf'. This is a two-level 
     17    on the Application object itself, as 'app.config'. This is a two-level 
    1818    dict where each key is a path, or "relative URL" (for example, "/" or 
    1919    "/path/to/my/page"), and each value is a config dict. Usually, this 
    20     data is provided in the call to cherrypy.tree.mount(root(), conf=conf), 
     20    data is provided in the call to cherrypy.tree.mount(root(), config=conf), 
    2121    although you may also use app.merge(conf). 
    2222     
     
    136136        dict.update(self, self.defaults) 
    137137     
    138     def update(self, conf): 
     138    def update(self, config): 
    139139        """Update self from a dict, file or filename.""" 
    140         if isinstance(conf, basestring): 
     140        if isinstance(config, basestring): 
    141141            # Filename 
    142             if conf not in cherrypy.engine.reload_files: 
    143                 cherrypy.engine.reload_files.append(conf
    144             conf = _Parser().dict_from_file(conf
    145         elif hasattr(conf, 'read'): 
     142            if config not in cherrypy.engine.reload_files: 
     143                cherrypy.engine.reload_files.append(config
     144            config = _Parser().dict_from_file(config
     145        elif hasattr(config, 'read'): 
    146146            # Open file object 
    147             conf = _Parser().dict_from_file(conf
     147            config = _Parser().dict_from_file(config
    148148        else: 
    149             conf = conf.copy() 
    150          
    151         if isinstance(conf.get("global", None), dict): 
    152             conf = conf["global"] 
    153          
    154         if 'environment' in conf
    155             env = environments[conf['environment']] 
     149            config = config.copy() 
     150         
     151        if isinstance(config.get("global", None), dict): 
     152            config = config["global"] 
     153         
     154        if 'environment' in config
     155            env = environments[config['environment']] 
    156156            for k in env: 
    157                 if k not in conf
    158                     conf[k] = env[k] 
    159          
    160         if 'tools.staticdir.dir' in conf
    161             conf['tools.staticdir.section'] = "global" 
     157                if k not in config
     158                    config[k] = env[k] 
     159         
     160        if 'tools.staticdir.dir' in config
     161            config['tools.staticdir.section'] = "global" 
    162162         
    163163        # Must use this idiom in order to hit our custom __setitem__. 
    164         for k, v in conf.iteritems(): 
     164        for k, v in config.iteritems(): 
    165165            self[k] = v 
    166166     
  • trunk/cherrypy/_cprequest.py

    r1303 r1311  
    150150        if hasattr(root, "_cp_config"): 
    151151            nodeconf.update(root._cp_config) 
    152         if "/" in app.conf
    153             nodeconf.update(app.conf["/"]) 
     152        if "/" in app.config
     153            nodeconf.update(app.config["/"]) 
    154154        object_trail = [('root', root, nodeconf, curpath)] 
    155155         
     
    167167                    nodeconf.update(node._cp_config) 
    168168             
    169             # Mix in values from app.conf for this path. 
     169            # Mix in values from app.config for this path. 
    170170            curpath = "/".join((curpath, name)) 
    171             if curpath in app.conf
    172                 nodeconf.update(app.conf[curpath]) 
     171            if curpath in app.config
     172                nodeconf.update(app.config[curpath]) 
    173173             
    174174            object_trail.append((objname, node, nodeconf, curpath)) 
     
    558558        dispatch = self.dispatch 
    559559        # First, see if there is a custom dispatch at this URI. Custom 
    560         # dispatchers can only be specified in app.conf, not in _cp_config 
     560        # dispatchers can only be specified in app.config, not in _cp_config 
    561561        # (since custom dispatchers may not even have an app.root). 
    562562        trail = path 
    563563        while trail: 
    564             nodeconf = self.app.conf.get(trail, {}) 
     564            nodeconf = self.app.config.get(trail, {}) 
    565565            d = nodeconf.get("request.dispatch") 
    566566            if d: 
  • trunk/cherrypy/_cptools.py

    r1298 r1311  
    167167     
    168168    def _setup(self): 
    169         """Hook this tool into cherrypy.request using the given conf
     169        """Hook this tool into cherrypy.request
    170170         
    171171        The standard CherryPy request object will automatically call this 
     
    216216     
    217217    def _setup(self): 
    218         """Hook this tool into cherrypy.request using the given conf.""" 
     218        """Hook this tool into cherrypy.request.""" 
    219219        request = cherrypy.request 
    220220        # Guard against running this method twice. 
     
    272272     
    273273    def _setup(self): 
    274         """Hook caching into cherrypy.request using the given conf.""" 
     274        """Hook caching into cherrypy.request.""" 
    275275        conf = self._merged_args() 
    276276        cherrypy.request.hooks.attach('before_main', self._wrapper, **conf) 
  • trunk/cherrypy/_cptree.py

    r1309 r1311  
    2121        explicitly set to None, then CherryPy will attempt to provide 
    2222        it each time from request.wsgi_environ['SCRIPT_NAME']. 
    23     conf: a dict of {path: pathconf} pairs, where 'pathconf' is itself 
     23    config: a dict of {path: pathconf} pairs, where 'pathconf' is itself 
    2424        a dict of {key: value} pairs. 
    2525    """ 
     
    3131        self.namespaces = {"log": lambda k, v: setattr(self.log, k, v), 
    3232                           } 
    33         self.conf = {} 
     33        self.config = {} 
    3434     
    3535    def _get_script_name(self): 
     
    4343    script_name = property(fget=_get_script_name, fset=_set_script_name) 
    4444     
    45     def merge(self, conf): 
     45    def merge(self, config): 
    4646        """Merge the given config into self.config.""" 
    47         _cpconfig.merge(self.conf, conf
     47        _cpconfig.merge(self.config, config
    4848         
    4949        # Handle namespaces specified in config. 
    50         rootconf = self.conf.get("/", {}) 
     50        rootconf = self.config.get("/", {}) 
    5151        for k, v in rootconf.iteritems(): 
    5252            atoms = k.split(".", 1) 
     
    206206        self.apps = {} 
    207207     
    208     def mount(self, root, script_name="", conf=None): 
    209         """Mount a new app from a root object, script_name, and conf.""" 
     208    def mount(self, root, script_name="", config=None): 
     209        """Mount a new app from a root object, script_name, and config.""" 
    210210        # Next line both 1) strips trailing slash and 2) maps "/" -> "". 
    211211        script_name = script_name.rstrip("/") 
     
    224224                root.favicon_ico = tools.staticfile.handler(favicon) 
    225225         
    226         if conf
    227             app.merge(conf
     226        if config
     227            app.merge(config
    228228         
    229229        self.apps[script_name] = app 
  • trunk/cherrypy/test/test_core.py

    r1302 r1311  
    378378        '/method': {'request.methods_with_bodies': ("POST", "PUT", "PROPFIND")}, 
    379379        } 
    380     cherrypy.tree.mount(root, conf=appconf) 
     380    cherrypy.tree.mount(root, config=appconf) 
    381381 
    382382 
  • trunk/cherrypy/test/test_etags.py

    r1275 r1311  
    1717    conf = {'/': {'tools.etags.on': True, 
    1818                  'tools.etags.autotags': True}} 
    19     cherrypy.tree.mount(Root(), conf=conf) 
     19    cherrypy.tree.mount(Root(), config=conf) 
    2020    cherrypy.config.update({'environment': 'test_suite'}) 
    2121 
  • trunk/cherrypy/test/test_static.py

    r1275 r1311  
    4949        } 
    5050     
    51     cherrypy.tree.mount(root, conf=conf) 
     51    cherrypy.tree.mount(root, config=conf) 
    5252    cherrypy.config.update({'environment': 'test_suite'}) 
    5353 
  • trunk/cherrypy/test/test_tools.py

    r1280 r1311  
    177177        }, 
    178178    } 
    179     cherrypy.tree.mount(root, conf=conf) 
     179    cherrypy.tree.mount(root, config=conf) 
    180180 
    181181 
  • trunk/cherrypy/test/test_wsgi_ns.py

    r1310 r1311  
    4242    p = cherrypy.wsgi.pipeline(app, [('changecase', ChangeCase)]) 
    4343    p.config['changecase'] = {'to': 'upper'} 
    44     cherrypy.tree.mount(app, conf={'/': root_conf}) 
     44    cherrypy.tree.mount(app, config={'/': root_conf}) 
    4545     
    4646    # If we do not supply any middleware in code, pipeline is much cleaner: 
    4747    # app = cherrypy.Application(Root()) 
    4848    # cherrypy.wsgi.pipeline(app) 
    49     # cherrypy.tree.mount(app, conf={'/': root_conf}) 
     49    # cherrypy.tree.mount(app, config={'/': root_conf}) 
    5050 
    5151 

Hosted by WebFaction

Log in as guest/cpguest to create tickets