Changeset 308
- Timestamp:
- 06/14/05 10:34:18
- Files:
-
- trunk/cherrypy/_cpconfig.py (modified) (5 diffs)
- trunk/cherrypy/lib/profiler.py (modified) (1 diff)
- trunk/cherrypy/test/test.py (modified) (2 diffs)
- trunk/cherrypy/test/test_baseurl_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_cache_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_combinedfilters.py (modified) (1 diff)
- trunk/cherrypy/test/test_core.py (modified) (1 diff)
- trunk/cherrypy/test/test_decodingencoding_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_gzip_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_logdebuginfo_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_objectmapping.py (modified) (1 diff)
- trunk/cherrypy/test/test_static_filter.py (modified) (1 diff)
- trunk/cherrypy/test/test_tutorials.py (modified) (3 diffs)
- trunk/cherrypy/test/test_virtualhost_filter.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tut08_sessions.py (modified) (1 diff)
- trunk/cherrypy/tutorial/tutorial.conf (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cpconfig.py
r300 r308 33 33 'sessionFilter.new': 'sessionMap', # legacy setting 34 34 } 35 configMap = {" /": defaultGlobal.copy()}35 configMap = {"global": defaultGlobal.copy()} 36 36 37 37 def update(updateMap=None, file=None): 38 38 if updateMap: 39 39 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' 40 45 s = configMap.get(section) 41 46 if not s: … … 51 56 # Look, ma, no Python function calls! Uber-fast. 52 57 # start path lest you overload the starting search path (needed by getAll) 53 54 58 global cpg 55 59 if not cpg: … … 70 74 result = configMap[path][key] 71 75 except KeyError: 72 if path != "/":76 if path not in ("/", "global"): 73 77 i = path.rfind("/") 74 78 if i < 0: … … 77 81 path = path[:i] 78 82 continue 83 elif path != "global": 84 path = "global" 85 continue 79 86 else: 80 87 result = defaultValue … … 82 89 83 90 if returnSection: 91 if path == 'global': 92 return '/' 84 93 return path 85 94 else: trunk/cherrypy/lib/profiler.py
r267 r308 140 140 from cherrypy import cpg 141 141 cpg.root = Profiler(path) 142 cpg.config.update({' /': {'server.serverPort': port,142 cpg.config.update({'global': {'server.serverPort': port, 143 143 'server.threadPool': 10, 144 144 'server.environment': "production", trunk/cherrypy/test/test.py
r300 r308 173 173 print "Running tests:", name 174 174 175 cpg.config.update({' /': server_conf.copy()})175 cpg.config.update({'global': server_conf.copy()}) 176 176 helper.startServer(server) 177 177 for testmod in testList: … … 179 179 # because each module uses/overwrites cpg globals. 180 180 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()}) 183 183 suite = CPTestLoader.loadTestsFromName(testmod) 184 184 CPTestRunner(verbosity=2).run(suite) trunk/cherrypy/test/test_baseurl_filter.py
r267 r308 37 37 cpg.root = Root() 38 38 cpg.config.update({ 39 ' /': {39 'global': { 40 40 'server.environment': 'production', 41 41 'baseUrlFilter.on': True, trunk/cherrypy/test/test_cache_filter.py
r267 r308 42 42 cpg.root = Root() 43 43 cpg.config.update({ 44 ' /': {44 'global': { 45 45 'server.logToScreen': False, 46 46 'server.environment': 'production', trunk/cherrypy/test/test_combinedfilters.py
r267 r308 41 41 cpg.root = Root() 42 42 cpg.config.update({ 43 ' /': {43 'global': { 44 44 'server.logToScreen': False, 45 45 'server.environment': 'production', trunk/cherrypy/test/test_core.py
r267 r308 122 122 123 123 cpg.config.update({ 124 ' /': {124 'global': { 125 125 'server.logToScreen': False, 126 126 'server.environment': 'production', trunk/cherrypy/test/test_decodingencoding_filter.py
r267 r308 38 38 cpg.root = Root() 39 39 cpg.config.update({ 40 ' /': {40 'global': { 41 41 'server.logToScreen': False, 42 42 'server.environment': 'production', trunk/cherrypy/test/test_gzip_filter.py
r267 r308 37 37 cpg.root = Root() 38 38 cpg.config.update({ 39 ' /': {39 'global': { 40 40 'server.logToScreen': False, 41 41 'server.environment': 'production', trunk/cherrypy/test/test_logdebuginfo_filter.py
r288 r308 36 36 cpg.root = Root() 37 37 cpg.config.update({ 38 ' /': {38 'global': { 39 39 'session.storageType': 'ram', 40 40 'session.timeout': 60, trunk/cherrypy/test/test_objectmapping.py
r267 r308 94 94 cpg.root.dir1.dir2.dir3.dir4 = Dir4() 95 95 cpg.config.update({ 96 ' /': {96 'global': { 97 97 'server.logToScreen': False, 98 98 } trunk/cherrypy/test/test_static_filter.py
r267 r308 34 34 cpg.root = Root() 35 35 cpg.config.update({ 36 ' /': {36 'global': { 37 37 'staticFilter.on': False, 38 38 'server.logToScreen': False, trunk/cherrypy/test/test_tutorials.py
r300 r308 43 43 """Import or reload tutorial module as needed.""" 44 44 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()}) 47 47 48 48 target = "cherrypy.tutorial." + tutorialName … … 145 145 def test08Sessions(self): 146 146 load_tut_module("tut08_sessions") 147 cpg.config.update({" /": {"sessionFilter.on": True}})147 cpg.config.update({"global": {"sessionFilter.on": True}}) 148 148 149 149 helper.request('/') … … 170 170 def test10SessionFilter(self): 171 171 load_tut_module("tut10_sessionfilter") 172 cpg.config.update({" /": {"sessionFilter.on": True}})172 cpg.config.update({"global": {"sessionFilter.on": True}}) 173 173 174 174 helper.request('/') trunk/cherrypy/test/test_virtualhost_filter.py
r267 r308 36 36 cpg.root = Root() 37 37 cpg.config.update({ 38 ' /': {38 'global': { 39 39 'server.logToScreen': False, 40 40 'server.environment': 'production', trunk/cherrypy/tutorial/tut08_sessions.py
r300 r308 29 29 30 30 cpg.root = HitCounter() 31 cpg.config.update({' /': {'sessionFilter.on': True}})31 cpg.config.update({'global': {'sessionFilter.on': True}}) 32 32 33 33 if __name__ == '__main__': trunk/cherrypy/tutorial/tutorial.conf
r242 r308 1 [ /]1 [global] 2 2 server.socketPort = 8080 3 3 server.threadPool = 10

