ckan / ckanext-spatial

Geospatial extension for CKAN
http://docs.ckan.org/projects/ckanext-spatial
126 stars 193 forks source link

change str validator to unicode_safe #312

Closed FuhuXia closed 1 year ago

FuhuXia commented 1 year ago

This PR replaces six.text_type with unicode_safe as validator.

six.text_type returns str for python3, using str as validator generates the following error seen on v2.0.0.

...
  File "/home/vcap/deps/1/src/ckanext-harvest/ckanext/harvest/queue.py", line 515, in fetch_and_import_stages
    success_import = harvester.import_stage(obj)
  File "/home/vcap/deps/1/src/ckanext-spatial/ckanext/spatial/harvesters/base.py", line 721, in import_stage
    package_id = p.toolkit.get_action('package_update')(context, package_dict)
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/logic/__init__.py", line 551, in wrapped
    result = _action(context, data_dict, **kw)
...
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/logic/__init__.py", line 551, in wrapped
    result = _action(context, data_dict, **kw)
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/logic/action/get.py", line 1085, in package_show
    package_dict, _errors = lib_plugins.plugin_validate(
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/lib/plugins.py", line 331, in plugin_validate
    return validate(data_dict, schema, context)
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/lib/navl/dictization_functions.py", line 305, in validate
    flat_data, errors = _validate(flattened, schema, validators_context)
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/lib/navl/dictization_functions.py", line 356, in _validate
    convert(converter, key, converted_data, errors, context)
  File "/home/vcap/deps/1/python/lib/python3.9/site-packages/ckan/lib/navl/dictization_functions.py", line 248, in convert
    raise TypeError(
TypeError: str cannot be used as validator because it is not a user-defined function