(self, name, func)
Add a callback from a hook.
Add a callback from a hook.
Add a callback from a hook .
def add_hook(self, name, func):
        ''' Add a callback from a hook. '''
        if name not in self.hooks:
            raise ValueError("Unknown hook name %s" % name)
        if name in ('after_request'):
            self.hooks[name].insert(0, func)
        else:
            self.hooks[name].append(func)
def add_hook ( self , name , func ) : if name not in self . hooks : raise ValueError ( "Unknown hook name %s" % name ) if name in ( 'after_request' ) : self . hooks [ name ] . insert ( 0 , func ) else : self . hooks [ name ] . append ( func )