[ckan-dev] Affecting previews in a plugin

Thomas Dunham thomas.dunham at okfn.org
Wed Feb 27 16:22:47 UTC 2013


Hi all,
I'm trying to write a plugin that affects if a dataset is
preview-able. Specifically  if a fairly large dataset is linked then CKAN
will attempt to preview this via the dataproxy and that will time out. My
aim is to use something in the background to follow the urls (and redirect
chains) of linked packages and eventually do a HEAD request and see if
there is a content-length.

So this prompts a couple of questions:

1. How to hook into the preview rendering machenery. I can't  use
IResourcePreview as I'll step on the toes of other packages. I looked for a
while at IPackageController but it looks like there's no means to get into
the resource_datapreview method on PackageController. So that leaves me
with a change to ckan core to add a new extension point (yuck) or monkey
patching (yuck squared).

2. I'll need to store the dataset sizes somewhere. I can't find any docs on
creating database tables in the extension docs - is there an example of an
extension that creates its own db tables somewhere?

Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20130227/f4fe9880/attachment.html>


More information about the ckan-dev mailing list