#NEWLINE# def sort( self , objs ) : #NEWLINE# #INDENT# def key( item ) : #NEWLINE# #INDENT# field_val = item . get ( self . field , '' ) #NEWLINE# if ( self . case_insensitive and isinstance ( field_val , unicode ) ) : #NEWLINE# #INDENT# field_val = field_val . lower ( ) #NEWLINE# #UNINDENT# return field_val #NEWLINE# #UNINDENT# return sorted ( objs , key = self , reverse = ( not self . ascending ) )