ckan / ckanext-harvest

Remote harvesting extension for CKAN
130 stars 203 forks source link

replace usage of six.text_type in schemas #461

Closed TomeCirun closed 2 years ago

TomeCirun commented 2 years ago

fix #460

TomeCirun commented 2 years ago

@amercader Thanks

TomeCirun commented 2 years ago

Hey @amercader do you have any idea why this one has failed ? Thanks

frafra commented 2 years ago

I still encounter the same failure when running the fetch command.

frafra commented 2 years ago

Hey @amercader do you have any idea why this one has failed ? Thanks

I tried your code on Docker:

ckan-harvester-fetch_1    | 2021-10-21 16:57:56,707 INFO  [ckanext.harvest.harvesters.base] Package with GUID 91126700 does not exist, let's create it
ckan-harvester-fetch_1    | 2021-10-21 16:57:56,712 ERROR [ckanext.harvest.harvesters.base] str cannot be used as validator because it is not a user-defined function
ckan-harvester-fetch_1    | Traceback (most recent call last):
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/lib/python3.8/site-packages/ckanext/harvest/harvesters/base.py", line 310, in _create_or_update_package
ckan-harvester-fetch_1    |     existing_package_dict = self._find_existing_package(package_dict)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/lib/python3.8/site-packages/ckanext/harvest/harvesters/base.py", line 393, in _find_existing_package
ckan-harvester-fetch_1    |     return p.toolkit.get_action('package_show')(
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/logic/__init__.py", line 496, in wrapped
ckan-harvester-fetch_1    |     result = _action(context, data_dict, **kw)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/logic/action/get.py", line 960, in package_show
ckan-harvester-fetch_1    |     raise NotFound
ckan-harvester-fetch_1    | ckan.logic.NotFound
ckan-harvester-fetch_1    | 
ckan-harvester-fetch_1    | During handling of the above exception, another exception occurred:
ckan-harvester-fetch_1    | 
ckan-harvester-fetch_1    | Traceback (most recent call last):
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py", line 222, in convert
ckan-harvester-fetch_1    |     nargs = converter.__code__.co_argcount
ckan-harvester-fetch_1    | AttributeError: type object 'str' has no attribute '__code__'
ckan-harvester-fetch_1    | 
ckan-harvester-fetch_1    | During handling of the above exception, another exception occurred:
ckan-harvester-fetch_1    | 
ckan-harvester-fetch_1    | Traceback (most recent call last):
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/lib/python3.8/site-packages/ckanext/harvest/harvesters/base.py", line 371, in _create_or_update_package
ckan-harvester-fetch_1    |     new_package = p.toolkit.get_action(
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/logic/__init__.py", line 496, in wrapped
ckan-harvester-fetch_1    |     result = _action(context, data_dict, **kw)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/logic/action/create.py", line 174, in package_create
ckan-harvester-fetch_1    |     data, errors = lib_plugins.plugin_validate(
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/lib/plugins.py", line 313, in plugin_validate
ckan-harvester-fetch_1    |     return toolkit.navl_validate(data_dict, schema, context)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py", line 278, in validate
ckan-harvester-fetch_1    |     converted_data, errors = _validate(flattened, schema, validators_context)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py", line 328, in _validate
ckan-harvester-fetch_1    |     convert(converter, key, converted_data, errors, context)
ckan-harvester-fetch_1    |   File "/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py", line 224, in convert
ckan-harvester-fetch_1    |     raise TypeError(
ckan-harvester-fetch_1    | TypeError: str cannot be used as validator because it is not a user-defined function
db_1                      | 2021-10-21 16:57:56.714 UTC [73] ERROR:  insert or update on table "harvest_object" violates foreign key constraint "harvest_object_package_id_fkey"
db_1                      | 2021-10-21 16:57:56.714 UTC [73] DETAIL:  Key (package_id)=(91126700) is not present in table "package".
db_1                      | 2021-10-21 16:57:56.714 UTC [73] STATEMENT:  COMMIT
TomeCirun commented 2 years ago

I tried your code on Docker:

hey @frafra can you try it now? Thanks

TomeCirun commented 2 years ago

Adrià, this one is important too, otherwise, we cannot use ckanext-harvest alongside CKAN Master

amercader commented 2 years ago

Thanks @TomeCirun! This is now in master. I fixed the 2.7 failures and squashed your commits to clean up a bit (e8362c4616db0944ff9c0c98649515a40d8ee6c5 and 83e42c6273ab60bc208e884eb71fc6561ef4de38)