nodes: 0, module; 1, function_definition; 2, function_name:process_request; 3, parameters; 4, block; 5, identifier:self; 6, identifier:request; 7, expression_statement; 8, function_definition; 9, if_statement; 10, if_statement; 11, comment:"""
          Setup the profiler for a profiling run and clear the SQL query log.
  
          If this is a resort of an existing profiling run, just return
          the resorted list.
          """; 12, function_name:unpickle; 13, parameters; 14, block; 15, boolean_operator; 16, block; 17, parenthesized_expression; 18, block; 19, identifier:params; 20, expression_statement; 21, expression_statement; 22, return_statement; 23, comparison_operator:request.method != 'GET'; 24, line_continuation:\; 25, not_operator; 26, return_statement; 27, boolean_operator; 28, expression_statement; 29, expression_statement; 30, if_statement; 31, assignment; 32, assignment; 33, expression_list; 34, attribute; 35, string; 36, parenthesized_expression; 37, call; 38, parenthesized_expression; 39, assignment; 40, assignment; 41, parenthesized_expression; 42, comment:# Instantly re-sort the existing stats data; 43, block; 44, elif_clause; 45, else_clause; 46, identifier:stats; 47, call; 48, identifier:queries; 49, call; 50, identifier:stats; 51, identifier:queries; 52, identifier:request; 53, identifier:method; 54, string_content:GET; 55, comparison_operator:request.META.get(
                 'HTTP_CONTENT_TYPE', request.META.get('CONTENT_TYPE', '')
             ) in ['multipart/form-data', 'application/x-www-form-urlencoded']; 56, attribute; 57, argument_list; 58, boolean_operator; 59, attribute; 60, call; 61, identifier:params; 62, attribute; 63, boolean_operator; 64, expression_statement; 65, return_statement; 66, parenthesized_expression; 67, block; 68, comment:# We don't have previous data, so initialize the profiler; 69, block; 70, identifier:unpickle_stats; 71, argument_list; 72, attribute; 73, argument_list; 74, call; 75, list; 76, attribute; 77, identifier:get; 78, string; 79, False; 80, comparison_operator:settings.DEBUG == True; 81, attribute; 82, identifier:request; 83, identifier:statsfile; 84, attribute; 85, argument_list; 86, identifier:request; 87, identifier:REQUEST; 88, call; 89, comparison_operator:params.get('show_queries', '1') == '1'; 90, assignment; 91, call; 92, boolean_operator; 93, expression_statement; 94, return_statement; 95, expression_statement; 96, expression_statement; 97, call; 98, identifier:cPickle; 99, identifier:loads; 100, call; 101, attribute; 102, argument_list; 103, string; 104, string; 105, identifier:request; 106, identifier:REQUEST; 107, string_content:profile; 108, attribute; 109, True; 110, attribute; 111, identifier:is_staff; 112, identifier:tempfile; 113, identifier:NamedTemporaryFile; 114, attribute; 115, argument_list; 116, call; 117, string; 118, pattern_list; 119, call; 120, identifier:display_stats; 121, argument_list; 122, call; 123, comparison_operator:params.get('show_stats', '1') == '1'; 124, assignment; 125, call; 126, assignment; 127, call; 128, identifier:b64decode; 129, argument_list; 130, identifier:b64decode; 131, argument_list; 132, attribute; 133, identifier:get; 134, string; 135, call; 136, string_content:multipart/form-data; 137, string_content:application/x-www-form-urlencoded; 138, identifier:settings; 139, identifier:DEBUG; 140, identifier:request; 141, identifier:user; 142, identifier:params; 143, identifier:get; 144, string; 145, False; 146, attribute; 147, argument_list; 148, string_content:1; 149, identifier:stats; 150, identifier:queries; 151, identifier:unpickle; 152, argument_list; 153, identifier:request; 154, identifier:stats; 155, identifier:queries; 156, attribute; 157, argument_list; 158, call; 159, string; 160, pattern_list; 161, call; 162, identifier:display_queries; 163, argument_list; 164, attribute; 165, call; 166, identifier:reset_queries; 167, argument_list; 168, call; 169, call; 170, identifier:request; 171, identifier:META; 172, string_content:HTTP_CONTENT_TYPE; 173, attribute; 174, argument_list; 175, string_content:show_stats; 176, identifier:params; 177, identifier:get; 178, string; 179, string; 180, identifier:params; 181, identifier:params; 182, identifier:get; 183, string; 184, False; 185, attribute; 186, argument_list; 187, string_content:1; 188, identifier:stats; 189, identifier:queries; 190, identifier:unpickle; 191, argument_list; 192, identifier:request; 193, identifier:stats; 194, identifier:queries; 195, identifier:request; 196, identifier:profiler; 197, attribute; 198, argument_list; 199, attribute; 200, argument_list; 201, attribute; 202, argument_list; 203, attribute; 204, identifier:get; 205, string; 206, string; 207, string_content:show_queries; 208, string_content:1; 209, string_content:show_queries; 210, identifier:params; 211, identifier:get; 212, string; 213, string; 214, identifier:params; 215, identifier:hotshot; 216, identifier:Profile; 217, attribute; 218, identifier:params; 219, identifier:get; 220, string; 221, string; 222, identifier:params; 223, identifier:get; 224, string; 225, string; 226, identifier:request; 227, identifier:META; 228, string_content:CONTENT_TYPE; 229, string_content:show_stats; 230, string_content:1; 231, attribute; 232, identifier:name; 233, string_content:stats; 234, string_content:queries; 235, identifier:request; 236, identifier:statsfile
code: def process_request(self, request):
          """
          Setup the profiler for a profiling run and clear the SQL query log.
  
          If this is a resort of an existing profiling run, just return
          the resorted list.
          """
          def unpickle(params):
              stats = unpickle_stats(b64decode(params.get('stats', '')))
              queries = cPickle.loads(b64decode(params.get('queries', '')))
              return stats, queries
  
          if request.method != 'GET' and \
             not (request.META.get(
                 'HTTP_CONTENT_TYPE', request.META.get('CONTENT_TYPE', '')
             ) in ['multipart/form-data', 'application/x-www-form-urlencoded']):
              return
          if (request.REQUEST.get('profile', False) and
              (settings.DEBUG == True or request.user.is_staff)):
              request.statsfile = tempfile.NamedTemporaryFile()
              params = request.REQUEST
              if (params.get('show_stats', False)
                  and params.get('show_queries', '1') == '1'):
                  # Instantly re-sort the existing stats data
                  stats, queries = unpickle(params)
                  return display_stats(request, stats, queries)
              elif (params.get('show_queries', False)
                    and params.get('show_stats', '1') == '1'):
                  stats, queries = unpickle(params)
                  return display_queries(request, stats, queries)
              else:
                  # We don't have previous data, so initialize the profiler
                  request.profiler = hotshot.Profile(request.statsfile.name)
                  reset_queries()