#NEWLINE# def get_order_dir( field , default = 'ASC' ) : #NEWLINE# #INDENT# "\n    Returns the field name and direction for an order specification. For\n    example, '-foo' is returned as ('foo', 'DESC').\n\n    The 'default' param is used to indicate which way no prefix (or a '+'\n    prefix) should sort. The '-' prefix always sorts the opposite way.\n    " #NEWLINE# dirn = ORDER_DIR [ default ] #NEWLINE# if ( dirn [ 0 ] == '-' ) : #NEWLINE# #INDENT# return ( field [ 1 : ] , dirn [ 1 ] ) #NEWLINE# #UNINDENT# return ( field , dirn [ 0 ] )