[ckan-dev] Some default previews always created?

Philippe Duchesne pduchesne at gmail.com
Fri May 8 09:44:26 UTC 2015


I happen to have encountered the same thing this morning :-)

I have just submitted a pull request, it's an easy fix.

--p.

On Fri, May 8, 2015 at 10:57 AM, Adrià Mercader <adria.mercader at okfn.org>
wrote:

> Well, Philippe beat me to it!
>
> https://github.com/ckan/ckan/issues/2421
>
> On 8 May 2015 at 09:56, Adrià Mercader <adria.mercader at okfn.org> wrote:
> > This is weird, it definitely looks like is trying to create a resource
> > view and failing because a "Name" field is not present, but resource
> > views don't require a "name" field at all.
> >
> > Perhaps there is some mixup with schemas and the dataset one is
> > leaking into the context. Definitely something we should check. Is
> > this the CKAN harvester?
> >
> > As for why it's trying to create a view, make sure to leave
> > ckan.views.default_views empty (not commented):
> >
> > "If not present (or commented), the default value is used. If left
> > empty, no default views are created."
> >
> >
> >
> http://docs.ckan.org/en/latest/maintaining/configuration.html#ckan-views-default-views
> >
> > On 8 May 2015 at 08:29, Matthew Fullerton <matthew at smartlane.de> wrote:
> >> I'm having a weird and wonderful problem involving harvesting. I
> harvest 2963 datasets, and 3 of them cause an error (cryptic of course,
> implying that there is no name value, even though there is). After a lot of
> digging, I see it is because my resources (which only have one key - 'url',
> which is enough for a standard CKAN entry) have no name key, and this is
> upsetting (99% certain) the image preview when it tries to become created.
> These 3 datasets seem to be the only ones with .jpg resources. This is the
> stack trace:
> >>
> >> Traceback (most recent call last):
> >>   File
> "/usr/lib/ckan/default/src/ckanext-harvest/ckanext/harvest/harvesters/base.py",
> line 221, in _create_or_update_package
> >>     new_package = get_action('package_create_rest')(context,
> package_dict)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line
> 424, in wrapped
> >>     result = _action(context, data_dict, **kw)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py",
> line 1115, in package_create_rest
> >>     dictized_after = _get_action('package_create')(context,
> dictized_package)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line
> 424, in wrapped
> >>     result = _action(context, data_dict, **kw)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py",
> line 212, in package_create
> >>     context, {'package': data})
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line
> 424, in wrapped
> >>     result = _action(context, data_dict, **kw)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py",
> line 465, in package_create_default_resource_views
> >>     create_datastore_views=create_datastore_views)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/lib/datapreview.py", line
> 303, in add_views_to_dataset_resources
> >>     create_datastore_views)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/lib/datapreview.py", line
> 269, in add_views_to_resource
> >>     view)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line
> 424, in wrapped
> >>     result = _action(context, data_dict, **kw)
> >>   File "/usr/lib/ckan/default/src/ckan/ckan/logic/action/create.py",
> line 363, in resource_view_create
> >>     raise ValidationError(errors)
> >> ValidationError: None - {'name': ['Missing value']}
> >>
> >> However, I haven't included ANY resource views in my plugins list, and
> the I don't set the list of default views to create either. The docs imply
> that the image preview has to be added explicitly as a plugin - is this
> really the case?
> >>
> >> I'm not sure if its good that resource previews are allowed to have a
> stricter schema for validation than that of the dataset itself, but that's
> a separate issue. Right now I would just like to prevent
> 'package_create_default_resource_views' ever getting called.
> >>
> >> I'm on CKAN '2.4' (i.e. fairly recent master).
> >>
> >> Thanks for any help - this is driving me slightly crackers!
> >> Matt
> >> _______________________________________________
> >> ckan-dev mailing list
> >> ckan-dev at lists.okfn.org
> >> https://lists.okfn.org/mailman/listinfo/ckan-dev
> >> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.okfn.org/pipermail/ckan-dev/attachments/20150508/018da3ab/attachment-0003.html>


More information about the ckan-dev mailing list