#NEWLINE# def validate( self ) : #NEWLINE# #INDENT# '\n            Removes unknown columns\n            ' #NEWLINE# must_save = False #NEWLINE# gc = self . data #NEWLINE# columns = gc [ 'columns' ] #NEWLINE# col_count = len ( columns ) #NEWLINE# widths = gc . get ( 'widths' , None ) #NEWLINE# hiddens = gc . get ( 'hiddens' , None ) #NEWLINE# if ( widths is None ) : #NEWLINE# #INDENT# widths = [ None for x in valid_hiddens ] #NEWLINE# gc . update ( widths = widths ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( col_count != len ( widths ) ) : #NEWLINE# #INDENT# raise Exception ( ( '%d columns, but %d widths' % ( col_count , len ( widths ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if ( hiddens is None ) : #NEWLINE# #INDENT# hiddens = [ False for x in columns ] #NEWLINE# gc . update ( hiddens = hiddens ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( col_count != len ( hiddens ) ) : #NEWLINE# #INDENT# raise Exception ( ( '%d columns, but %d hiddens' % ( col_count , len ( hiddens ) ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# valid_columns = [ ] #NEWLINE# valid_widths = [ ] #NEWLINE# valid_hiddens = [ ] #NEWLINE# for ( i , colname ) in enumerate ( gc [ 'columns' ] ) : #NEWLINE# #INDENT# f = self . report . get_data_elem ( colname ) #NEWLINE# if ( f is None ) : #NEWLINE# #INDENT# logger . debug ( 'Removed unknown column %d (%r). Must save.' , i , colname ) #NEWLINE# must_save = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# valid_columns . append ( colname ) #NEWLINE# valid_widths . append ( widths [ i ] ) #NEWLINE# valid_hiddens . append ( hiddens [ i ] ) #NEWLINE# #UNINDENT# #UNINDENT# gc . update ( widths = valid_widths ) #NEWLINE# gc . update ( hiddens = valid_hiddens ) #NEWLINE# gc . update ( columns = valid_columns ) #NEWLINE# return must_save