#NEWLINE# def prepare_headers( request , bound_columns ) : #NEWLINE# #INDENT# '\n    :type bound_columns: list of BoundColumn\n    ' #NEWLINE# for column in bound_columns : #NEWLINE# #INDENT# if column . sortable : #NEWLINE# #INDENT# params = request . GET . copy ( ) #NEWLINE# order = request . GET . get ( 'order' , None ) #NEWLINE# start_sort_desc = column [ 'sort_default_desc' ] #NEWLINE# params [ 'order' ] = ( column [ 'name' ] if ( not start_sort_desc ) else ( '-' + column [ 'name' ] ) ) #NEWLINE# if ( order is not None ) : #NEWLINE# #INDENT# is_desc = ( ( len ( order ) > 0 ) and ( order [ 0 ] == '-' ) ) #NEWLINE# order_field = ( ( is_desc and order [ 1 : ] ) or order ) #NEWLINE# if ( order_field == column [ 'name' ] ) : #NEWLINE# #INDENT# new_order = ( ( is_desc and order [ 1 : ] ) or ( '-%s' % order ) ) #NEWLINE# params [ 'order' ] = new_order #NEWLINE# #UNINDENT# #UNINDENT# column . is_sorting = ( False if ( order is None ) else ( ( column . name == order ) or ( ( '-' + column . name ) == order ) ) ) #NEWLINE# column . url = ( '?%s' % params . urlencode ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# column . is_sorting = False #NEWLINE# #UNINDENT# #UNINDENT# return bound_columns