def get_order_dir(field, default='ASC'):
 dirn = ORDER_DIR[default]
 if (field[0] == '-'):
  return (field[1:], dirn[1])
 return (field, dirn[0])

def get_order_dir ( field , default = 'ASC' ) : dirn = ORDER_DIR [ default ] if ( field [ 0 ] == '-' ) : return ( field [ 1 : ] , dirn [ 1 ] ) return ( field , dirn [ 0 ] )
returns the field name and direction for an order specification .