Skip to content

Commit

Permalink
fixed #1 after testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Pieter Colpaert committed Dec 11, 2013
1 parent b8a27b4 commit 45b2580
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions ckanext/tdt/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def can_preview(self, data_dict):
if(rname == ""):
rname = "unnamed"
tdt_uri = self.tdt_host + "/ckan/" + rid + "/" + rname
r = requests.head(tdt_uri)
r = requests.get(tdt_uri)

This comment has been minimized.

Copy link
@pietercolpaert

pietercolpaert Dec 11, 2013

Member

@coreation head is not implemented?

This comment has been minimized.

Copy link
@coreation

coreation Dec 11, 2013

Member

Not yet. Will include in the 4.0.1 patch, perhaps we should make a milestone for that, been thinking about some small improvements here and there that can be put into a patch worthy update.

log.info(r.status_code)
return r.status_code == 200

Expand All @@ -73,15 +73,17 @@ def create_tdt_source(self, entity):
if(entity.name == ""):
entity.name = "unnamed"
tdt_uri = self.tdt_host + "/api/definitions/ckan/" + entity.id + "/" + entity.name
log.info(tdt_uri)
r = requests.put(tdt_uri,
auth=(self.tdt_user, self.tdt_pass),
data="{'description':'" + entity.description +"','uri':'" + entity.url + "'}",
data=json.dumps({'description': entity.description,'uri':entity.url }),
headers={'Content-Type' : 'application/tdt.' + entity.format.lower() })

if(r.status_code == 200):
log.info(r.headers["content-location"])
elif (r.status_code > 200):
log.error("Could not add dataset \""+ entity.name +"\" to The DataTank")
log.error("Could not add dataset - \""+ entity.name +"\" - to The DataTank")
log.error("This is the error message: " + r.text)
log.error(r.status_code)

return
Expand Down

0 comments on commit 45b2580

Please sign in to comment.