Changeset 1340
- Timestamp:
- 09/08/06 13:09:59
- Files:
-
- trunk/cherrypy/_cpwsgiserver.py (modified) (2 diffs)
- trunk/cherrypy/lib/wsgiapp.py (modified) (1 diff)
- trunk/cherrypy/test/helper.py (modified) (3 diffs)
- trunk/cherrypy/test/test.py (modified) (6 diffs)
- trunk/cherrypy/test/test_config.py (modified) (1 diff)
- trunk/cherrypy/test/test_wsgiapps.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cpwsgiserver.py
r1332 r1340 216 216 # Must use keys() here for Python 2.3 (rfc822.Message had no __iter__). 217 217 for k in headers.keys(): 218 if k in ('transfer-encoding', 'content-type', 'content-length'): 219 continue 220 218 221 envname = "HTTP_" + k.upper().replace("-", "_") 219 222 if k in comma_separated_headers: … … 223 226 else: 224 227 environ[envname] = ", ".join(headers.getheaders(k)) 225 elif k in ('Transfer-Encoding',):226 pass227 228 else: 228 229 environ[envname] = headers[k] trunk/cherrypy/lib/wsgiapp.py
r1288 r1340 1 """ a WSGI application tool for CherryPy"""1 """A CherryPy tool for hosting a foreign WSGI application.""" 2 2 3 3 import sys trunk/cherrypy/test/helper.py
r1278 r1340 102 102 args=(moduleNames, conf)) 103 103 104 def sync_apps(profile=False ):104 def sync_apps(profile=False, validate=False): 105 105 apps = [] 106 106 for base, app in cherrypy.tree.apps.iteritems(): … … 108 108 base = "" 109 109 if profile: 110 apps.append((base, profiler.make_app(app, aggregate=False))) 111 else: 112 apps.append((base, app)) 110 app = profiler.make_app(app, aggregate=False) 111 if validate: 112 try: 113 from wsgiref import validate 114 except ImportError: 115 warnings.warn("Error importing wsgiref. The validator will not run.") 116 app = validate.validator(app) 117 apps.append((base, app)) 113 118 apps.sort() 114 119 apps.reverse() … … 131 136 # The setup functions probably mounted new apps. 132 137 # Tell our server about them. 133 sync_apps(profile=conf.get("profiling.on", False)) 138 sync_apps(profile=conf.get("profiling.on", False), 139 validate=conf.get("validator.on", False)) 134 140 135 141 suite = CPTestLoader.loadTestsFromName(testmod) trunk/cherrypy/test/test.py
r1330 r1340 85 85 self.cover = False 86 86 self.profile = False 87 self.validate = False 87 88 self.server = None 88 89 self.protocol = "HTTP/1.1" 89 90 90 longopts = ['cover', 'profile', ' 1.0', 'help', 'basedir=', 'port=',91 longopts = ['cover', 'profile', 'validate', '1.0', 'help', 'basedir=', 'port=', 91 92 'server='] 92 93 longopts.extend(self.available_tests) … … 108 109 elif o == "--profile": 109 110 self.profile = True 111 elif o == "--validate": 112 self.validate = True 110 113 elif o == "--1.0": 111 114 self.protocol = "HTTP/1.0" … … 140 143 print """CherryPy Test Program 141 144 Usage: 142 test.py --server=* --port=%s --1.0 --cover --basedir=path --profile -- tests**145 test.py --server=* --port=%s --1.0 --cover --basedir=path --profile --validate --tests** 143 146 144 147 """ % self.__class__.port … … 159 162 160 163 --profile: turn on profiling tool 164 --validate: use wsgiref.validate (builtin in Python 2.5). 161 165 """ % self.__class__.port 162 166 … … 265 269 conf['profiling.on'] = True 266 270 271 if self.validate: 272 conf = conf or {} 273 conf['validator.on'] = True 274 267 275 if self.server == 'cpmodpy': 268 276 from cherrypy.test import modpy … … 281 289 282 290 if self.profile: 283 del conf['profiling.on']284 291 print 285 292 print ("run /cherrypy/lib/profiler.py as a script to serve " trunk/cherrypy/test/test_config.py
r1336 r1340 57 57 handler = cherrypy.request.handler 58 58 def wrapper(): 59 # 'value' is a type (like int or str). 59 60 return value(handler()) 60 61 cherrypy.request.handler = wrapper trunk/cherrypy/test/test_wsgiapps.py
r1275 r1340 27 27 results = list(results) 28 28 results.reverse() 29 return "".join(results)29 return ["".join(results)] 30 30 return _app 31 31

