Changeset 1427
- Timestamp:
- 11/07/06 15:43:06
- Files:
-
- trunk/cherrypy/_cptools.py (modified) (4 diffs)
- trunk/cherrypy/lib/cptools.py (modified) (1 diff)
- trunk/cherrypy/lib/encoding.py (modified) (1 diff)
- trunk/cherrypy/lib/wsgiapp.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cptools.py
r1425 r1427 4 4 may only offer one if they choose): 5 5 6 Library calls: all tools are callables that can be used wherever needed. 6 Library calls: 7 All tools are callables that can be used wherever needed. 7 8 The arguments are straightforward and should be detailed within the 8 9 docstring. … … 14 15 decorated function's _cp_config attribute. 15 16 16 CherryPy hooks: "hooks" are points in the CherryPy request-handling17 process which may hand off control to registered callbacks. The18 Request object possesses a "hooks" attribute (a HookMap) for19 manipulating this. If a tool exposes a "_setup" callable, it20 will be called once per Request (if the feature is "turned on"21 via config).17 CherryPy config: 18 Hookpoints are places in the CherryPy request-handling process 19 which may hand off control to registered callbacks. The Request 20 object possesses a "hooks" attribute (a HookMap) for manipulating 21 this. If a tool exposes a "_setup" callable, it will be called 22 once per Request (if the feature is "turned on" via config). 22 23 23 24 Tools may be implemented as any object with a namespace. The builtins … … 224 225 """Hook this tool into cherrypy.request.""" 225 226 request = cherrypy.request 227 226 228 # Guard against running this method twice. 227 229 if hasattr(request, 'xmlrpc'): 228 230 return 229 231 request.xmlrpc = True 232 230 233 request.error_response = _xmlrpc.on_error 231 234 path_info = request.path_info … … 327 330 328 331 default_toolbox = _d = Toolbox("tools") 329 default_toolbox.session_auth = SessionAuthTool(cptools.session_auth)332 _d.session_auth = SessionAuthTool(cptools.session_auth) 330 333 _d.proxy = Tool('before_request_body', cptools.proxy, priority=30) 331 334 _d.response_headers = Tool('on_start_resource', cptools.response_headers) trunk/cherrypy/lib/cptools.py
r1422 r1427 264 264 setattr(sa, k, v) 265 265 return sa.run() 266 session_auth.__doc__ = """Session authentication hook. 267 268 Any attribute of the SessionAuth class may be overridden via a keyword arg 269 to this function: 270 271 """ + "\n".join(["%s: %s" % (k, type(getattr(SessionAuth, k)).__name__) 272 for k in dir(SessionAuth) if not k.startswith("__")]) 266 273 267 274 trunk/cherrypy/lib/encoding.py
r1402 r1427 41 41 # value is a list: decode each element 42 42 decoded_params[key] = [v.decode(encoding) for v in value] 43 elif isinstance(value, unicode): 44 pass 43 45 else: 44 46 # value is a regular string: decode it trunk/cherrypy/lib/wsgiapp.py
r1388 r1427 50 50 51 51 def run(app, env=None): 52 """Run the (WSGI) app and set response.body to its output"""52 """Run the given WSGI app and set response.body to its output.""" 53 53 try: 54 environ = cherrypy.request.wsgi_environ 54 environ = cherrypy.request.wsgi_environ.copy() 55 55 environ['SCRIPT_NAME'] = cherrypy.request.script_name 56 56 environ['PATH_INFO'] = cherrypy.request.path_info … … 64 64 response = app(environ, start_response) 65 65 try: 66 cherrypy.response.body = response66 cherrypy.response.body = [x for x in response] 67 67 finally: 68 68 if hasattr(response, "close"):

