[ckan-dev] A new ckan client library: ckanapi

Ian Ward ian at excess.org
Mon Apr 15 16:18:06 UTC 2013


On Mon, Apr 15, 2013 at 10:59 AM, Toby Dacre <toby.okfn at gmail.com> wrote:
>  Ian,
>
> I'm a little concerned with these imports
>
>     from ckan.logic import (ParameterError, NotAuthorized, NotFound,
>
>                             ValidationError)
>     from ckan.lib.search import SearchQueryError, SearchError
>
>
>  I'd be happier for you just to create your own exceptions like you do
> anyhow.  This will allow us to refactor ckan without breaking your code.

Hi Toby, thanks for taking a look.

The reason I import CKAN's exceptions is because I have code that
calls actions on a local CKAN instance from a plugin and code that
calls actions on a remote CKAN instance in the same place, and I would
like the exceptions that either raise to be the same.

https://github.com/open-data/ckanext-canada/blob/master/ckanext/canada/commands.py#L309

Are you suggesting I convert the exceptions that CKAN raises to my own
copies of them in the "local CKAN" case?  .. doing something like
checking the name of the exception?

You're right, if one of the exception classes gets moved then ckanapi
will stop working in a strange way (exceptions from LocalCKAN won't
get caught anymore) which should be fixed somehow.

Ian




More information about the ckan-dev mailing list