#NEWLINE# def select_template( self , template_name_list ) : #NEWLINE# #INDENT# '\n        Given a list of template names, returns the first that can be loaded.\n        ' #NEWLINE# if ( not template_name_list ) : #NEWLINE# #INDENT# raise TemplateDoesNotExist ( 'No template names provided' ) #NEWLINE# #UNINDENT# not_found = [ ] #NEWLINE# for template_name in template_name_list : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return self . get_template ( template_name ) #NEWLINE# #UNINDENT# except TemplateDoesNotExist as exc : #NEWLINE# #INDENT# if ( exc . args [ 0 ] not in not_found ) : #NEWLINE# #INDENT# not_found . append ( exc . args [ 0 ] ) #NEWLINE# #UNINDENT# continue #NEWLINE# #UNINDENT# #UNINDENT# raise TemplateDoesNotExist ( ', ' . join ( not_found ) )