Package cherrypy :: Module _cptools :: Class HandlerTool
[hide private]
[frames] | no frames]

Class HandlerTool

source code

object --+    
         |    
      Tool --+
             |
            HandlerTool
Known Subclasses:

Tool which is called 'before main', that may skip normal handlers.

If the tool successfully handles the request (by setting response.body), if should return True. This will cause CherryPy to skip any 'normal' page handler. If the tool did not handle the request, it should return False to tell CherryPy to continue on and call the normal page handler. If the tool is declared AS a page handler (see the 'handler' method), returning False will raise NotFound.

Instance Methods [hide private]
 
__init__(self, callable, name=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
handler(self, *args, **kwargs)
Use this tool as a CherryPy page handler.
source code
 
_wrapper(self, **kwargs) source code
 
_setup(self)
Hook this tool into cherrypy.request.
source code

Inherited from Tool: __call__

Inherited from Tool (private): _merged_args, _setargs

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from Tool: namespace

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, callable, name=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

handler(self, *args, **kwargs)

source code 
Use this tool as a CherryPy page handler.

For example:
    class Root:
        nav = tools.staticdir.handler(section="/nav", dir="nav",
                                      root=absDir)

_setup(self)

source code 

Hook this tool into cherrypy.request.

The standard CherryPy request object will automatically call this method when the tool is "turned on" in config.

Overrides: Tool._setup