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

Changeset 308

Show
Ignore:
Timestamp:
06/14/05 10:34:18
Author:
rdelon
Message:

Now using 'global' for the main config key. ('/' still works but 'global' is the default). Still need to update the docs

Files:

Legend:

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

    r300 r308  
    3333    'sessionFilter.new': 'sessionMap', # legacy setting 
    3434    } 
    35 configMap = {"/": defaultGlobal.copy()} 
     35configMap = {"global": defaultGlobal.copy()} 
    3636 
    3737def update(updateMap=None, file=None): 
    3838    if updateMap: 
    3939        for section, valueMap in updateMap.items(): 
     40            if not isinstance(valueMap, dict): 
     41                # Shortcut syntax 
     42                #   ex: update({'server.socketPort': 80}) 
     43                valueMap = {section: valueMap} 
     44                section = 'global' 
    4045            s = configMap.get(section) 
    4146            if not s: 
     
    5156    # Look, ma, no Python function calls! Uber-fast. 
    5257    # start path lest you overload the starting search path (needed by getAll) 
    53      
    5458    global cpg 
    5559    if not cpg: 
     
    7074            result = configMap[path][key] 
    7175        except KeyError: 
    72             if path != "/"
     76            if path not in ("/", "global")
    7377                i = path.rfind("/") 
    7478                if i < 0: 
     
    7781                    path = path[:i] 
    7882                    continue 
     83            elif path != "global": 
     84                path = "global" 
     85                continue 
    7986            else: 
    8087                result = defaultValue 
     
    8289     
    8390    if returnSection: 
     91        if path == 'global': 
     92            return '/' 
    8493        return path 
    8594    else: 
  • trunk/cherrypy/lib/profiler.py

    r267 r308  
    140140    from cherrypy import cpg 
    141141    cpg.root = Profiler(path) 
    142     cpg.config.update({'/': {'server.serverPort': port, 
     142    cpg.config.update({'global': {'server.serverPort': port, 
    143143                             'server.threadPool': 10, 
    144144                             'server.environment': "production", 
  • trunk/cherrypy/test/test.py

    r300 r308  
    173173        print "Running tests:", name 
    174174         
    175         cpg.config.update({'/': server_conf.copy()}) 
     175        cpg.config.update({'global': server_conf.copy()}) 
    176176        helper.startServer(server) 
    177177        for testmod in testList: 
     
    179179            # because each module uses/overwrites cpg globals. 
    180180            cpg.config.configMap.clear() 
    181             cpg.config.configMap["/"] = cpg.config.defaultGlobal.copy() 
    182             cpg.config.update({'/': server_conf.copy()}) 
     181            cpg.config.configMap["global"] = cpg.config.defaultGlobal.copy() 
     182            cpg.config.update({'global': server_conf.copy()}) 
    183183            suite = CPTestLoader.loadTestsFromName(testmod) 
    184184            CPTestRunner(verbosity=2).run(suite) 
  • trunk/cherrypy/test/test_baseurl_filter.py

    r267 r308  
    3737cpg.root = Root() 
    3838cpg.config.update({ 
    39     '/': { 
     39    'global': { 
    4040        'server.environment': 'production', 
    4141        'baseUrlFilter.on': True, 
  • trunk/cherrypy/test/test_cache_filter.py

    r267 r308  
    4242cpg.root = Root() 
    4343cpg.config.update({ 
    44     '/': { 
     44    'global': { 
    4545        'server.logToScreen': False, 
    4646        'server.environment': 'production', 
  • trunk/cherrypy/test/test_combinedfilters.py

    r267 r308  
    4141cpg.root = Root() 
    4242cpg.config.update({ 
    43     '/': { 
     43    'global': { 
    4444        'server.logToScreen': False, 
    4545        'server.environment': 'production', 
  • trunk/cherrypy/test/test_core.py

    r267 r308  
    122122 
    123123cpg.config.update({ 
    124     '/': { 
     124    'global': { 
    125125        'server.logToScreen': False, 
    126126        'server.environment': 'production', 
  • trunk/cherrypy/test/test_decodingencoding_filter.py

    r267 r308  
    3838cpg.root = Root() 
    3939cpg.config.update({ 
    40     '/': { 
     40    'global': { 
    4141        'server.logToScreen': False, 
    4242        'server.environment': 'production', 
  • trunk/cherrypy/test/test_gzip_filter.py

    r267 r308  
    3737cpg.root = Root() 
    3838cpg.config.update({ 
    39     '/': { 
     39    'global': { 
    4040        'server.logToScreen': False, 
    4141        'server.environment': 'production', 
  • trunk/cherrypy/test/test_logdebuginfo_filter.py

    r288 r308  
    3636cpg.root = Root() 
    3737cpg.config.update({ 
    38     '/': { 
     38    'global': { 
    3939        'session.storageType': 'ram', 
    4040        'session.timeout': 60, 
  • trunk/cherrypy/test/test_objectmapping.py

    r267 r308  
    9494cpg.root.dir1.dir2.dir3.dir4 = Dir4() 
    9595cpg.config.update({ 
    96     '/': { 
     96    'global': { 
    9797        'server.logToScreen': False, 
    9898    } 
  • trunk/cherrypy/test/test_static_filter.py

    r267 r308  
    3434cpg.root = Root() 
    3535cpg.config.update({ 
    36     '/': { 
     36    'global': { 
    3737        'staticFilter.on': False, 
    3838        'server.logToScreen': False, 
  • trunk/cherrypy/test/test_tutorials.py

    r300 r308  
    4343    """Import or reload tutorial module as needed.""" 
    4444    cpg.config.configMap.clear() 
    45     cpg.config.configMap["/"] = cpg.config.defaultGlobal.copy() 
    46     cpg.config.update({'/': server_conf.copy()}) 
     45    cpg.config.configMap["global"] = cpg.config.defaultGlobal.copy() 
     46    cpg.config.update({'global': server_conf.copy()}) 
    4747     
    4848    target = "cherrypy.tutorial." + tutorialName 
     
    145145    def test08Sessions(self): 
    146146        load_tut_module("tut08_sessions") 
    147         cpg.config.update({"/": {"sessionFilter.on": True}}) 
     147        cpg.config.update({"global": {"sessionFilter.on": True}}) 
    148148         
    149149        helper.request('/') 
     
    170170    def test10SessionFilter(self): 
    171171        load_tut_module("tut10_sessionfilter") 
    172         cpg.config.update({"/": {"sessionFilter.on": True}}) 
     172        cpg.config.update({"global": {"sessionFilter.on": True}}) 
    173173         
    174174        helper.request('/') 
  • trunk/cherrypy/test/test_virtualhost_filter.py

    r267 r308  
    3636cpg.root = Root() 
    3737cpg.config.update({ 
    38     '/': { 
     38    'global': { 
    3939        'server.logToScreen': False, 
    4040        'server.environment': 'production', 
  • trunk/cherrypy/tutorial/tut08_sessions.py

    r300 r308  
    2929 
    3030cpg.root = HitCounter() 
    31 cpg.config.update({'/': {'sessionFilter.on': True}}) 
     31cpg.config.update({'global': {'sessionFilter.on': True}}) 
    3232 
    3333if __name__ == '__main__': 
  • trunk/cherrypy/tutorial/tutorial.conf

    r242 r308  
    1 [/
     1[global
    22server.socketPort = 8080 
    33server.threadPool = 10 

Hosted by WebFaction

Log in as guest/cpguest to create tickets