Changeset 1282
- Timestamp:
- 08/26/06 13:20:29
- Files:
-
- branches/cherrypy-2.x/cherrypy/config.py (modified) (2 diffs)
- branches/cherrypy-2.x/cherrypy/test/test_config.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/cherrypy-2.x/cherrypy/config.py
r1004 r1282 185 185 186 186 def getAll(key): 187 """Lookup key in the current node and all of its parent nodes 188 as a list of path, value pairs. 189 """ 190 # Needed by the session filter 191 187 """Return a list of (path, value) pairs for current node and all parents.""" 192 188 try: 193 189 results = [('global', configs['global'][key])] … … 200 196 return results 201 197 202 pathList = path.split('/') 203 204 for n in xrange(1, len(pathList)): 205 path = '/' + '/'.join(pathList[0:n+1]) 198 try: 199 results.append(('/', configs['/'][key])) 200 except KeyError: 201 pass 202 203 atoms = path.strip('/').split('/') 204 path = "" 205 for atom in atoms: 206 path = path + "/" + atom 206 207 try: 207 208 results.append((path, configs[path][key])) branches/cherrypy-2.x/cherrypy/test/test_config.py
r1022 r1282 22 22 bar = index 23 23 nex = index 24 25 def getall(self, key): 26 return repr(cherrypy.config.getAll(key)) 27 getall.exposed = True 24 28 25 29 class Env: … … 91 95 self.getPage(path + "?key=" + key) 92 96 self.assertBody(expected) 97 98 self.getPage("/foo/getall?key=foo") 99 self.assertBody("[('/', 'this'), ('/foo', 'this2')]") 93 100 94 101 def testUnrepr(self):

