#NEWLINE# def addhooks( self ) : #NEWLINE# #INDENT# ' Add hook script XML elements to the metadata tag.\n        ' #NEWLINE# hooks = self . createElement ( 'Hooks' ) #NEWLINE# for state in sorted ( self . session . _hooks . keys ( ) ) : #NEWLINE# #INDENT# for ( filename , data ) in self . session . _hooks [ state ] : #NEWLINE# #INDENT# hook = self . createElement ( 'Hook' ) #NEWLINE# hook . setAttribute ( 'name' , filename ) #NEWLINE# hook . setAttribute ( 'state' , str ( state ) ) #NEWLINE# txt = self . createTextNode ( data ) #NEWLINE# hook . appendChild ( txt ) #NEWLINE# hooks . appendChild ( hook ) #NEWLINE# #UNINDENT# #UNINDENT# if hooks . hasChildNodes ( ) : #NEWLINE# #INDENT# self . meta . appendChild ( hooks )