Ejemplo n.º 1
0
 def organisations_with_broken_resource_links(self, id, format='json'):
     result = organisations_with_broken_resource_links()
     if format == 'csv':
         filename = '%s.csv' % (id)
         response.headers['Content-Type'] = 'application/csv'
         response.headers['Content-Disposition'] = str(
             'attachment; filename=%s' % (filename))
         rows = []
         for organisation, datasets in result.items():
             for dataset, resources in datasets.items():
                 for resource in resources:
                     row = [
                         organisation[0],
                         unicode(organisation[1]),
                         dataset[0],
                         dataset[1],
                         resource.get('url'),
                         unicode(resource.get('openness_score')),
                         resource.get('openness_score_reason'),
                     ]
                     rows.append(row)
         return make_csv(
             result,
             headers,
             rows,
         )
     else:
         response.headers['Content-Type'] = 'application/json'
         return json.dumps(result)
Ejemplo n.º 2
0
 def organisations_with_broken_resource_links(self, id, format='json'):
     result = organisations_with_broken_resource_links()
     if format == 'csv':
         rows = []
         for organisation, datasets in result.items():
             for dataset, resources in datasets.items():
                 for resource in resources:
                     row = [
                         organisation[0],
                         unicode(organisation[1]),
                         dataset[0],
                         dataset[1],
                         resource.get('url'),
                         unicode(resource.get('openness_score')),
                         resource.get('openness_score_reason'),
                     ]
                     rows.append(row)
         return  self._output_csv_file(self.headers, rows, id)
     else:
         return self._output_json(result)
Ejemplo n.º 3
0
 def organisations_with_broken_resource_links(self, id, format='json'):
     result = organisations_with_broken_resource_links()
     if format == 'csv':
         rows = []
         for organisation, datasets in result.items():
             for dataset, resources in datasets.items():
                 for resource in resources:
                     row = [
                         organisation[0],
                         unicode(organisation[1]),
                         dataset[0],
                         dataset[1],
                         resource.get('url'),
                         unicode(resource.get('openness_score')),
                         resource.get('openness_score_reason'),
                     ]
                     rows.append(row)
         return self._output_csv_file(self.headers, rows, id)
     else:
         return self._output_json(result)
Ejemplo n.º 4
0
 def organisations_with_broken_resource_links(self, id, format="json"):
     result = organisations_with_broken_resource_links()
     if format == "csv":
         filename = "%s.csv" % (id)
         response.headers["Content-Type"] = "application/csv"
         response.headers["Content-Disposition"] = str("attachment; filename=%s" % (filename))
         rows = []
         for organisation, datasets in result.items():
             for dataset, resources in datasets.items():
                 for resource in resources:
                     row = [
                         organisation[0],
                         unicode(organisation[1]),
                         dataset[0],
                         dataset[1],
                         resource.get("url"),
                         unicode(resource.get("openness_score")),
                         resource.get("openness_score_reason"),
                     ]
                     rows.append(row)
         return make_csv(result, headers, rows)
     else:
         response.headers["Content-Type"] = "application/json"
         return json.dumps(result)