#NEWLINE# def _prepare_headers( self ) : #NEWLINE# #INDENT# headers = prepare_headers ( self . request , self . shown_bound_columns ) #NEWLINE# header_groups = [ ] #NEWLINE# class HeaderGroup ( Struct ) : #NEWLINE# #INDENT# def render_css_class( self ) : #NEWLINE# #INDENT# return render_class ( self . attrs [ 'class' ] ) #NEWLINE# #UNINDENT# #UNINDENT# for ( group_name , group_iterator ) in groupby ( headers , key = ( lambda header : ( header . group or id ( header ) ) ) ) : #NEWLINE# #INDENT# header_group = list ( group_iterator ) #NEWLINE# header_groups . append ( HeaderGroup ( display_name = group_name , sortable = False , colspan = len ( header_group ) , attrs = Struct ( { #NEWLINE# #INDENT# 'class' : Struct ( superheader = True ) , #NEWLINE# #UNINDENT# } ) ) ) #NEWLINE# for x in header_group : #NEWLINE# #INDENT# x . attrs [ 'class' ] [ 'subheader' ] = True #NEWLINE# if x . is_sorting : #NEWLINE# #INDENT# x . attrs [ 'class' ] [ 'sorted_column' ] = True #NEWLINE# #UNINDENT# #UNINDENT# header_group [ 0 ] . attrs [ 'class' ] [ 'first_column' ] = True #NEWLINE# #UNINDENT# if header_groups : #NEWLINE# #INDENT# header_groups [ 0 ] . attrs [ 'class' ] [ 'first_column' ] = True #NEWLINE# #UNINDENT# for x in header_groups : #NEWLINE# #INDENT# if ( not isinstance ( x . display_name , string_types ) ) : #NEWLINE# #INDENT# x . display_name = '' #NEWLINE# #UNINDENT# #UNINDENT# if all ( [ ( x . display_name == '' ) for x in header_groups ] ) : #NEWLINE# #INDENT# header_groups = [ ] #NEWLINE# #UNINDENT# self . header_levels = ( [ header_groups , headers ] if ( len ( header_groups ) > 1 ) else [ headers ] ) #NEWLINE# return headers