#NEWLINE# def retrieveBoilerplateFile( self , name , group = None , status = None , error = True ) : #NEWLINE# #INDENT# if ( ( group is None ) and ( self . md . group is not None ) ) : #NEWLINE# #INDENT# group = self . md . group . lower ( ) #NEWLINE# #UNINDENT# if ( status is None ) : #NEWLINE# #INDENT# status = self . md . status #NEWLINE# #UNINDENT# localFolder = os . path . dirname ( os . path . abspath ( self . inputSource ) ) #NEWLINE# includeFolder = os . path . join ( config . scriptPath , 'include' ) #NEWLINE# statusFile = '{0}-{1}.include' . format ( name , status ) #NEWLINE# genericFile = '{0}.include' . format ( name ) #NEWLINE# filenames = [ ] #NEWLINE# filenames . append ( os . path . join ( localFolder , statusFile ) ) #NEWLINE# filenames . append ( os . path . join ( localFolder , genericFile ) ) #NEWLINE# if group : #NEWLINE# #INDENT# filenames . append ( os . path . join ( includeFolder , group , statusFile ) ) #NEWLINE# filenames . append ( os . path . join ( includeFolder , group , genericFile ) ) #NEWLINE# #UNINDENT# filenames . append ( os . path . join ( localFolder , statusFile ) ) #NEWLINE# filenames . append ( os . path . join ( includeFolder , genericFile ) ) #NEWLINE# for filename in filenames : #NEWLINE# #INDENT# if os . path . isfile ( filename ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# with io . open ( filename , 'r' , encoding = 'utf-8' ) as fh : #NEWLINE# #INDENT# return fh . read ( ) #NEWLINE# #UNINDENT# #UNINDENT# except IOError : #NEWLINE# #INDENT# if error : #NEWLINE# #INDENT# die ( 'The include file for {0} disappeared underneath me.' , name ) #NEWLINE# #UNINDENT# return '' #NEWLINE# #UNINDENT# break #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if error : #NEWLINE# #INDENT# die ( "Couldn't find an appropriate include file for the {0} inclusion, given group='{1}' and status='{2}'." , name , group , status ) #NEWLINE# #UNINDENT# return ''