[CKAN-support] Structure of c.pkg?
Nigel Babu
nigel.babu at okfn.org
Thu Mar 20 06:28:00 UTC 2014
Something like this:
import ckan.plugins.toolkit as tk
tk.get_action('package_show')({}, {'id': id})
Nigel Babu
Developer | @nigelbabu <https://twitter.com/nigelbabu>
The Open Knowledge Foundation <http://okfn.org/>
Empowering through Open Knowledge
http://okfn.org/ | @okfn <http://twitter.com/OKFN> | OKF on
Facebook<https://www.facebook.com/OKFNetwork> |
Blog <http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter>
CKAN | http://ckan.org/ | @CKANproject
<http://twitter.com/CKANproject> |the world’s leading open-source data
portal platform
On 20 March 2014 11:47, Carlos Quiros <cquiros at qlands.com> wrote:
> ok.
>
> And how I do that? Or you mean using CKAN API and do a package_show?
>
> I got that code from the Spatial example.
>
> Carlos.
>
>
> On 03/20/2014 06:57 AM, Nigel Babu wrote:
>
> The best way would be to do a package_show action function and not calling
> the package model directly.
>
> Nigel Babu
>
> Developer | @nigelbabu <https://twitter.com/nigelbabu>
>
> The Open Knowledge Foundation <http://okfn.org/>
>
> Empowering through Open Knowledge
>
> http://okfn.org/ | @okfn <http://twitter.com/OKFN> | OKF on Facebook<https://www.facebook.com/OKFNetwork> |
> Blog <http://blog.okfn.org/> | Newsletter<http://okfn.org/about/newsletter>
>
> CKAN | http://ckan.org/ | @CKANproject <http://twitter.com/CKANproject>|the world’s leading open-source data portal platform
>
>
> On 19 March 2014 20:16, Carlos Quiros <cquiros at qlands.com> wrote:
>
>> Hi,
>>
>> I am having this code:
>>
>> import ckan.plugins.toolkit as toolkit
>> from ckan.lib.base import c, abort
>> from ckan.model import Package
>>
>> class metadataDDIController(toolkit.BaseController):
>> def getMetadataDDI(self,id):
>> toolkit.response.content_type = 'application/xml'
>> c.pkg = Package.get(id)
>> if c.pkg is None:
>> abort(404, 'Dataset not found')
>> return '<?xml version="1.0" encoding="utf-8"?><body>' +
>> c.pkg.description + '</body>'
>>
>> But I get that 'Package' object has no attribute 'description'
>>
>> How can I get the information of the package, particularly the extras?
>>
>> Thanks,
>> Carlos
>>
>> _______________________________________________
>> ckan-support mailing list
>> ckan-support at lists.okfn.org
>> https://lists.okfn.org/mailman/listinfo/ckan-support
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.okfn.org/mailman/private/ckan-support/attachments/20140320/aa2faaf7/attachment-0003.html>
More information about the ckan-support
mailing list