Changeset 1811
- Timestamp:
- 10/29/07 19:27:35
- Files:
-
- trunk/cherrypy/_cprequest.py (modified) (1 diff)
- trunk/cherrypy/_cptools.py (modified) (1 diff)
- trunk/cherrypy/lib/cptools.py (modified) (1 diff)
- trunk/cherrypy/test/test_misc_tools.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cprequest.py
r1786 r1811 57 57 """Run self.callback(**self.kwargs).""" 58 58 return self.callback(**self.kwargs) 59 60 def __repr__(self): 61 cls = self.__class__ 62 return ("%s.%s(callback=%r, failsafe=%r, priority=%r, %s)" 63 % (cls.__module__, cls.__name__, self.callback, 64 self.failsafe, self.priority, 65 ", ".join(['%s=%r' % (k, v) 66 for k, v in self.kwargs.iteritems()]))) 59 67 60 68 trunk/cherrypy/_cptools.py
r1770 r1811 428 428 _d.log_tracebacks = Tool('before_error_response', cptools.log_traceback) 429 429 _d.log_headers = Tool('before_error_response', cptools.log_request_headers) 430 _d.log_hooks = Tool('on_end_request', cptools.log_hooks, priority=100) 430 431 _d.err_redirect = ErrorTool(cptools.redirect) 431 432 _d.etags = Tool('before_finalize', cptools.validate_etags) trunk/cherrypy/lib/cptools.py
r1767 r1811 296 296 h = [" %s: %s" % (k, v) for k, v in cherrypy.request.header_list] 297 297 cherrypy.log('\nRequest Headers:\n' + '\n'.join(h), "HTTP") 298 299 def log_hooks(): 300 """Write request.hooks to the cherrypy error log.""" 301 msg = [] 302 # Sort by the standard points if possible. 303 from cherrypy import _cprequest 304 points = _cprequest.hookpoints 305 for k in cherrypy.request.hooks.keys(): 306 if k not in points: 307 points.append(k) 308 309 for k in points: 310 msg.append(" %s:" % k) 311 v = cherrypy.request.hooks.get(k, []) 312 v.sort() 313 for h in v: 314 msg.append(" %r" % h) 315 cherrypy.log('\nRequest Hooks:\n' + '\n'.join(msg), "HTTP") 298 316 299 317 def redirect(url='', internal=True): trunk/cherrypy/test/test_misc_tools.py
r1657 r1811 1 1 from cherrypy.test import test 2 2 test.prefer_parent_path() 3 4 import os 5 localDir = os.path.dirname(__file__) 6 logfile = os.path.join(localDir, "test_misc_tools.log") 3 7 4 8 import cherrypy … … 21 25 'tools.response_headers.headers': [("Content-Language", "fr"), 22 26 ('Content-Type', 'text/plain')], 27 'tools.log_hooks.on': True, 23 28 } 24 29 … … 68 73 root.accept = Accept() 69 74 cherrypy.tree.mount(root, config=conf) 70 cherrypy.config.update({'environment': 'test_suite'}) 75 cherrypy.config.update({'environment': 'test_suite', 76 'log.error_file': logfile}) 71 77 72 78

