#NEWLINE# def validate_indexes( self , data , required = True ) : #NEWLINE# #INDENT# if data . get ( 'index' ) : #NEWLINE# #INDENT# index_names = ( data [ 'index' ] , ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if data . get ( 'indexes' ) : #NEWLINE# #INDENT# index_names = data [ 'indexes' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( ( ( 'index' in data ) or ( 'indexes' in data ) ) and ( not required ) ) : #NEWLINE# #INDENT# return ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return None #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# indexes = list ( Index . select ( ) . where ( ( Index . name << index_names ) ) ) #NEWLINE# observed_names = set ( ( index . name for index in indexes ) ) #NEWLINE# invalid_names = [ ] #NEWLINE# for index_name in index_names : #NEWLINE# #INDENT# if ( index_name not in observed_names ) : #NEWLINE# #INDENT# invalid_names . append ( index_name ) #NEWLINE# #UNINDENT# #UNINDENT# if invalid_names : #NEWLINE# #INDENT# error ( ( 'The following indexes were not found: %s.' % ', ' . join ( required ) ) ) #NEWLINE# #UNINDENT# return indexes