Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.hooks.HookManager Class Reference

List of all members.

Public Member Functions

def __init__
def new
def new_filter
def add_callback
def remove_callback
def call
def filter_read
def filter_write

Public Attributes

 hooks
 filters

Detailed Description

Manage the set of hooks the application defines.

Definition at line 140 of file hooks.py.


Constructor & Destructor Documentation

Definition at line 144 of file hooks.py.

00144 
00145     def __init__(self):
00146         self.hooks = {}
00147         self.filters = {}
        

Member Function Documentation

def obnamlib.hooks.HookManager.add_callback (   self,
  name,
  callback,
  priority = Hook.DEFAULT_PRIORITY 
)
Add a callback to a named hook.

Definition at line 163 of file hooks.py.

00163 
00164     def add_callback(self, name, callback, priority=Hook.DEFAULT_PRIORITY):
00165         '''Add a callback to a named hook.'''
00166         if name in self.hooks:
00167             return self.hooks[name].add_callback(callback, priority)
00168         else:
00169             return self.filters[name].add_callback(callback, priority)
        
def obnamlib.hooks.HookManager.call (   self,
  name,
  args,
  kwargs 
)
Call callbacks for a named hook, using given arguments.

Definition at line 177 of file hooks.py.

00177 
00178     def call(self, name, *args, **kwargs):
00179         '''Call callbacks for a named hook, using given arguments.'''
00180         self.hooks[name].call_callbacks(*args, **kwargs)

def obnamlib.hooks.HookManager.filter_read (   self,
  name,
  args,
  kwargs 
)
Run reader filter for named filter, using given arguments.

Definition at line 181 of file hooks.py.

00181 
00182     def filter_read(self, name, *args, **kwargs):
00183         '''Run reader filter for named filter, using given arguments.'''
00184         return self.filters[name].run_filter_read(*args, **kwargs)

Here is the caller graph for this function:

def obnamlib.hooks.HookManager.filter_write (   self,
  name,
  args,
  kwargs 
)
Run writer filter for named filter, using given arguments.

Definition at line 185 of file hooks.py.

00185 
00186     def filter_write(self, name, *args, **kwargs):
00187         '''Run writer filter for named filter, using given arguments.'''
00188         return self.filters[name].run_filter_write(*args, **kwargs)

Here is the caller graph for this function:

def obnamlib.hooks.HookManager.new (   self,
  name 
)
Create a new hook.

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

Definition at line 148 of file hooks.py.

00148 
00149     def new(self, name):
00150         '''Create a new hook.
00151         
00152         If a hook with that name already exists, nothing happens.
00153         
00154         '''
00155 
00156         if name not in self.hooks:
00157             self.hooks[name] = Hook()

def obnamlib.hooks.HookManager.new_filter (   self,
  name 
)
Create a new filter hook.

Definition at line 158 of file hooks.py.

00158 
00159     def new_filter(self, name):
00160         '''Create a new filter hook.'''
00161         if name not in self.filters:
00162             self.filters[name] = FilterHook()

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

Definition at line 170 of file hooks.py.

00170 
00171     def remove_callback(self, name, callback_id):
00172         '''Remove a specific callback from a named hook.'''
00173         if name in self.hooks:
00174             self.hooks[name].remove_callback(callback_id)
00175         else:
00176             self.filters[name].remove_callback(callback_id)
        

Member Data Documentation

Definition at line 146 of file hooks.py.

Definition at line 145 of file hooks.py.


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