Changeset 1698
- Timestamp:
- 07/20/07 16:00:08
- Files:
-
- trunk/cherrypy/_cptools.py (modified) (1 diff)
- trunk/cherrypy/test/test_config.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cptools.py
r1668 r1698 66 66 67 67 def _merged_args(self, d=None): 68 if d: 69 conf = d.copy() 70 else: 71 conf = {} 72 68 73 tm = cherrypy.request.toolmaps[self.namespace] 69 74 if self._name in tm: 70 conf = tm[self._name].copy() 71 else: 72 conf = {} 73 if d: 74 conf.update(d) 75 conf.update(tm[self._name]) 76 75 77 if "on" in conf: 76 78 del conf["on"] 79 77 80 return conf 78 81 trunk/cherrypy/test/test_config.py
r1688 r1698 5 5 6 6 import os, sys 7 localDir = os.path.join(os.getcwd(), os.path.dirname(__file__)) 7 8 import StringIO 9 8 10 import cherrypy 9 11 … … 35 37 return self.db 36 38 dbscheme.exposed = True 39 40 favicon_ico = cherrypy.tools.staticfile.handler( 41 filename=os.path.join(localDir, '../favicon.ico')) 37 42 38 43 class Foo: … … 86 91 neg: -1234 87 92 filename: os.path.join(sys.prefix, "hello.py") 88 """) 93 94 [/favicon.ico] 95 tools.staticfile.filename = %r 96 """ % os.path.join(localDir, 'static/dirback.jpg')) 89 97 90 98 root = Root() … … 160 168 self.getPage("/dbscheme") 161 169 self.assertBody(r"sqlite///memory") 170 171 def testHandlerToolConfigOverride(self): 172 # Assert that config overrides tool constructor args. Above, we set 173 # the favicon in the page handler to be '../favicon.ico', 174 # but then overrode it in config to be './static/dirback.jpg'. 175 self.getPage("/favicon.ico") 176 self.assertBody(open(os.path.join(localDir, "static/dirback.jpg"), 177 "rb").read()) 162 178 163 179

