def sort_field(self, field_name, direction, field_vals=None):
field_name = self._normalize_field_name(field_name)<EOL>if direction > <NUM_LIT:0>:<EOL><INDENT>direction = <NUM_LIT:1><EOL><DEDENT>elif direction < <NUM_LIT:0>:<EOL><INDENT>direction = -<NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>".format(direction))<EOL><DEDENT>self.fields_sort.append(field_name, [direction, field_name, list(field_vals) if field_vals else field_vals])<EOL>return self<EOL>
sort this query by field_name in directrion

field_name -- string -- the field to sort on
direction -- integer -- negative for DESC, positive for ASC
field_vals -- list -- the order the rows should be returned in