Skip to content

Commit

Permalink
Accepting resource format in CSV format.
Browse files Browse the repository at this point in the history
  • Loading branch information
ykhadilkar committed Jun 30, 2014
1 parent 33e9df8 commit b81b9af
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ckanext/datajson/build_datajson.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,19 @@ def make_datajson_entry(package):
extras = dict([(x['key'], x['value']) for x in package['extras']])

retlist = []
#if resource format is CSV then convert it to text/csv
#Resource format has to be in 'csv' format for automatic datastore push.
for r in package["resources"]:
if r["format"].lower() == "csv":
r["format"] = "text/csv"

try:
retlist = [
("title", package["title"]), #required
("description", package["notes"]), #required
("keyword", [t["display_name"] for t in package["tags"]]),#required
#("modified", package["metadata_modified"]), #required
("modified", extras["modified"]), #required
("modified", extras.get("modified"), package["metadata_modified"]), #required
("publisher", extras.get('publisher', package['author'])), #required
('contactPoint', extras['contact_name']), #required
('mbox', extras['contact_email']), #required
Expand Down

0 comments on commit b81b9af

Please sign in to comment.