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

Changeset 1198

Show
Ignore:
Timestamp:
07/10/06 23:15:39
Author:
fumanchu
Message:

Caching tool invocation optimization.

Files:

Legend:

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

    r1189 r1198  
    152152    return wrapper 
    153153 
     154def _wrapper(): 
     155    if get(): 
     156        cherrypy.request.handler = None 
     157    else: 
     158        # Note the devious technique here of adding hooks on the fly 
     159        cherrypy.request.hooks.attach('before_finalize', tee_output) 
     160 
    154161def _setup(): 
    155162    """Hook caching into cherrypy.request using the given conf.""" 
     
    157164    if not getattr(cherrypy, "_cache", None): 
    158165        init(conf.get("class", None)) 
    159     def wrapper(): 
    160         if get(): 
    161             cherrypy.request.handler = None 
    162         else: 
    163             # Note the devious technique here of adding hooks on the fly 
    164             cherrypy.request.hooks.attach('before_finalize', tee_output) 
    165     cherrypy.request.hooks.attach('before_main', wrapper) 
     166    cherrypy.request.hooks.attach('before_main', _wrapper) 
    166167 

Hosted by WebFaction

Log in as guest/cpguest to create tickets