Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1427

Show
Ignore:
Timestamp:
11/07/06 15:43:06
Author:
fumanchu
Message:

Some tool buglets and docs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cptools.py

    r1425 r1427  
    44may only offer one if they choose): 
    55     
    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. 
    78        The arguments are straightforward and should be detailed within the 
    89        docstring. 
     
    1415        decorated function's _cp_config attribute. 
    1516     
    16     CherryPy hooks: "hooks" are points in the CherryPy request-handling 
    17         process which may hand off control to registered callbacks. The 
    18         Request object possesses a "hooks" attribute (a HookMap) for 
    19         manipulating this. If a tool exposes a "_setup" callable, it 
    20         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). 
    2223 
    2324Tools may be implemented as any object with a namespace. The builtins 
     
    224225        """Hook this tool into cherrypy.request.""" 
    225226        request = cherrypy.request 
     227         
    226228        # Guard against running this method twice. 
    227229        if hasattr(request, 'xmlrpc'): 
    228230            return 
    229231        request.xmlrpc = True 
     232         
    230233        request.error_response = _xmlrpc.on_error 
    231234        path_info = request.path_info 
     
    327330 
    328331default_toolbox = _d = Toolbox("tools") 
    329 default_toolbox.session_auth = SessionAuthTool(cptools.session_auth) 
     332_d.session_auth = SessionAuthTool(cptools.session_auth) 
    330333_d.proxy = Tool('before_request_body', cptools.proxy, priority=30) 
    331334_d.response_headers = Tool('on_start_resource', cptools.response_headers) 
  • trunk/cherrypy/lib/cptools.py

    r1422 r1427  
    264264        setattr(sa, k, v) 
    265265    return sa.run() 
     266session_auth.__doc__ = """Session authentication hook. 
     267 
     268Any attribute of the SessionAuth class may be overridden via a keyword arg 
     269to this function: 
     270 
     271""" + "\n".join(["%s: %s" % (k, type(getattr(SessionAuth, k)).__name__) 
     272                 for k in dir(SessionAuth) if not k.startswith("__")]) 
    266273 
    267274 
  • trunk/cherrypy/lib/encoding.py

    r1402 r1427  
    4141            # value is a list: decode each element 
    4242            decoded_params[key] = [v.decode(encoding) for v in value] 
     43        elif isinstance(value, unicode): 
     44            pass 
    4345        else: 
    4446            # value is a regular string: decode it 
  • trunk/cherrypy/lib/wsgiapp.py

    r1388 r1427  
    5050 
    5151def 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.""" 
    5353    try: 
    54         environ = cherrypy.request.wsgi_environ 
     54        environ = cherrypy.request.wsgi_environ.copy() 
    5555        environ['SCRIPT_NAME'] = cherrypy.request.script_name 
    5656        environ['PATH_INFO'] = cherrypy.request.path_info 
     
    6464    response = app(environ, start_response) 
    6565    try: 
    66         cherrypy.response.body = response 
     66        cherrypy.response.body = [x for x in response] 
    6767    finally: 
    6868        if hasattr(response, "close"): 

Hosted by WebFaction

Log in as guest/cpguest to create tickets