nodes: 0, module; 1, function_definition; 2, function_name:get_basic_sort_link; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, identifier:field; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, comment:"""
          Thanks to del_query_parameters and get_querystring, we build the link
          with preserving interesting get parameters and removing the others
          """; 14, assignment; 15, assignment; 16, identifier:sort_string; 17, block; 18, else_clause; 19, identifier:sort_link; 20, identifier:query_string; 21, call; 22, identifier:sort_string; 23, call; 24, expression_statement; 25, if_statement; 26, block; 27, attribute; 28, argument_list; 29, attribute; 30, argument_list; 31, assignment; 32, identifier:query_string; 33, block; 34, expression_statement; 35, if_statement; 36, identifier:self; 37, identifier:get_querystring; 38, identifier:self; 39, identifier:get_next_sort_string; 40, identifier:field; 41, identifier:sort_link; 42, binary_operator:request.path + '?' + sort_string; 43, expression_statement; 44, assignment; 45, identifier:query_string; 46, block; 47, binary_operator:request.path + '?'; 48, identifier:sort_string; 49, augmented_assignment; 50, identifier:sort_link; 51, attribute; 52, expression_statement; 53, attribute; 54, string; 55, identifier:sort_link; 56, binary_operator:'&' + query_string; 57, identifier:request; 58, identifier:path; 59, augmented_assignment; 60, identifier:request; 61, identifier:path; 62, string_content:?; 63, string; 64, identifier:query_string; 65, identifier:sort_link; 66, binary_operator:'?' + query_string; 67, string_content:&; 68, string; 69, identifier:query_string; 70, string_content:?
code: def get_basic_sort_link(self, request, field):
          """
          Thanks to del_query_parameters and get_querystring, we build the link
          with preserving interesting get parameters and removing the others
          """
          query_string = self.get_querystring()
          sort_string = self.get_next_sort_string(field)
          if sort_string:
              sort_link = request.path + '?' + sort_string
              if query_string:
                  sort_link += '&' + query_string
          else:
              sort_link = request.path
              if query_string:
                  sort_link += '?' + query_string
          return sort_link