#NEWLINE# def _run( self , name , method_type , args , kwargs , func = None ) : #NEWLINE# #INDENT# if ( method_type not in ( 'pre' , 'post' ) ) : #NEWLINE# #INDENT# msg = _ ( "Wrong type of hook method. Only 'pre' and 'post' type allowed" ) #NEWLINE# raise ValueError ( msg ) #NEWLINE# #UNINDENT# for e in self . extensions : #NEWLINE# #INDENT# obj = e . obj #NEWLINE# hook_method = getattr ( obj , method_type , None ) #NEWLINE# if hook_method : #NEWLINE# #INDENT# LOG . warning ( _LW ( 'Hooks are deprecated as of Nova 13.0 and will be removed in a future release' ) ) #NEWLINE# LOG . debug ( 'Running %(name)s %(type)s-hook: %(obj)s' , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'type' : method_type , #NEWLINE# 'obj' : obj , #NEWLINE# #UNINDENT# } ) #NEWLINE# try : #NEWLINE# #INDENT# if func : #NEWLINE# #INDENT# hook_method ( func , * name , ** kwargs ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# hook_method ( * args , ** kwargs ) #NEWLINE# #UNINDENT# #UNINDENT# except FatalHookException : #NEWLINE# #INDENT# msg = _LE ( 'Fatal Exception running %(name)s %(type)s-hook: %(obj)s' ) #NEWLINE# LOG . exception ( msg , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'type' : method_type , #NEWLINE# 'obj' : obj , #NEWLINE# #UNINDENT# } ) #NEWLINE# raise #NEWLINE# #UNINDENT# except Exception : #NEWLINE# #INDENT# msg = _LE ( 'Exception running %(name)s %(type)s-hook: %(obj)s' ) #NEWLINE# LOG . exception ( msg , { #NEWLINE# #INDENT# 'name' : name , #NEWLINE# 'type' : method_type , #NEWLINE# 'obj' : obj , #NEWLINE# #UNINDENT# } )