code: def calc_results(request, calc_id):
      
      # If the specified calculation doesn't exist OR is not yet complete,
      # throw back a 404.
      try:
          info = logs.dbcmd('calc_info', calc_id)
          if not utils.user_has_permission(request, info['user_name']):
              return HttpResponseForbidden()
      except dbapi.NotFound:
          return HttpResponseNotFound()
      base_url = _get_base_url(request)
  
      # NB: export_output has as keys the list (output_type, extension)
      # so this returns an ordered map output_type -> extensions such as
      # {'agg_loss_curve': ['xml', 'csv'], ...}
      output_types = groupby(export, lambda oe: oe[0],
                             lambda oes: [e for o, e in oes])
      results = logs.dbcmd('get_outputs', calc_id)
      if not results:
          return HttpResponseNotFound()
  
      response_data = []
      for result in results:
          try:  # output from the datastore
              rtype = result.ds_key
              # Catalina asked to remove the .txt outputs (used for the GMFs)
              outtypes = [ot for ot in output_types[rtype] if ot != 'txt']
          except KeyError:
              continue  # non-exportable outputs should not be shown
          url = urlparse.urljoin(base_url, 'v1/calc/result/%d' % result.id)
          datum = dict(
              id=result.id, name=result.display_name, type=rtype,
              outtypes=outtypes, url=url, size_mb=result.size_mb)
          response_data.append(datum)
  
      return HttpResponse(content=json.dumps(response_data))
docs: Get a summarized list of calculation results for a given ``calc_id``.
      Result is a JSON array of objects containing the following attributes:
  
          * id
          * name
          * type (hazard_curve, hazard_map, etc.)
          * url (the exact url where the full result can be accessed)