Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The extension has conflict with ckanext-scheming when no extras is available #4

Open
MandanaMoshref opened this issue Sep 18, 2023 · 0 comments

Comments

@MandanaMoshref
Copy link

I am using ckanext-scheming and ckanext-resourcedictionary. My schema includes both repeating_subfields and additional extra fields (normal text fields but additional to the standard ckan attributes). An error occurs when I want to add a resource dictionary for my dataset (see below). My understanding is that after updating/saving the resource dictionary, the action_type view will be called and this triggers the validator in scheming. As I have no extra in data_dict but a repeating_subfields, it tries to check for extras that do not exist, and thrwos an error.
Is there anyway that I can overcome this issue?
Below the error log:

2023-08-28 14:06:29,374 ERROR [ckan.config.middleware.flask_app] 'extras'
Traceback (most recent call last):
  File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/app.py", line 1484, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/app.py", line 1469, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/views.py", line 109, in view
    return current_app.ensure_sync(self.dispatch_request)(**kwargs)
  File "/usr/lib/ckan/default/lib/python3.8/site-packages/flask/views.py", line 190, in dispatch_request
    return current_app.ensure_sync(meth)(**kwargs)
  File "/usr/lib/ckan/default/src/ckanext-resourcedictionary/ckanext/resourcedictionary/views/resource_dictionary.py", line 98, in post
    get_action(u'resource_dictionary_create')(context, data_dict)
  File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line 548, in wrapped
    result = _action(context, data_dict, **kw)
  File "/usr/lib/ckan/default/src/ckanext-resourcedictionary/ckanext/resourcedictionary/logic/action/create.py", line 100, in resource_dictionary_create
    res = get_action(u'datastore_create')(
  File "/usr/lib/ckan/default/src/ckan/ckan/logic/__init__.py", line 548, in wrapped
    result = _action(context, data_dict, **kw)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/logic/action.py", line 172, in datastore_create
    set_datastore_active_flag(context, data_dict, True)
  File "/usr/lib/ckan/default/src/ckan/ckanext/datastore/logic/action.py", line 690, in set_datastore_active_flag
    psi.index_package(_data_dict)
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/search/index.py", line 123, in index_package
    validated_pkg_dict, _errors = lib_plugins.plugin_validate(
  File "/usr/lib/ckan/default/src/ckan/ckan/lib/plugins.py", line 332, in plugin_validate
    result = plugin.validate(context, data_dict, schema, action)
  File "/usr/lib/ckan/default/src/ckanext-scheming/ckanext/scheming/plugins.py", line 283, in validate
    for ex in data_dict['extras']:
KeyError: 'extras'
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant