Back to index

python-cliapp  1.20120630
Public Member Functions | Public Attributes
cliapp.hookmgr.HookManager Class Reference

List of all members.

Public Member Functions

def __init__
def new
def add_callback
def remove_callback
def call

Public Attributes

 hooks

Detailed Description

Manage the set of hooks the application defines.

Definition at line 21 of file hookmgr.py.


Constructor & Destructor Documentation

Definition at line 25 of file hookmgr.py.

00025 
00026     def __init__(self):
00027         self.hooks = {}
        

Member Function Documentation

def cliapp.hookmgr.HookManager.add_callback (   self,
  name,
  callback 
)
Add a callback to a named hook.

Definition at line 38 of file hookmgr.py.

00038 
00039     def add_callback(self, name, callback):
00040         '''Add a callback to a named hook.'''
00041         return self.hooks[name].add_callback(callback)
        
def cliapp.hookmgr.HookManager.call (   self,
  name,
  args,
  kwargs 
)
Call callbacks for a named hook, using given arguments.

Definition at line 46 of file hookmgr.py.

00046 
00047     def call(self, name, *args, **kwargs):
00048         '''Call callbacks for a named hook, using given arguments.'''
00049         return self.hooks[name].call_callbacks(*args, **kwargs)
00050 
def cliapp.hookmgr.HookManager.new (   self,
  name,
  hook 
)
Add a new hook to the manager.

If a hook with that name already exists, nothing happens.

Definition at line 28 of file hookmgr.py.

00028 
00029     def new(self, name, hook):
00030         '''Add a new hook to the manager.
00031         
00032         If a hook with that name already exists, nothing happens.
00033         
00034         '''
00035 
00036         if name not in self.hooks:
00037             self.hooks[name] = hook

def cliapp.hookmgr.HookManager.remove_callback (   self,
  name,
  callback_id 
)
Remove a specific callback from a named hook.

Definition at line 42 of file hookmgr.py.

00042 
00043     def remove_callback(self, name, callback_id):
00044         '''Remove a specific callback from a named hook.'''
00045         self.hooks[name].remove_callback(callback_id)
        

Member Data Documentation

Definition at line 26 of file hookmgr.py.


The documentation for this class was generated from the following file: