diff --git a/CHANGELOG.md b/CHANGELOG.md index 93110a947762390c59573e33e4a16e4c2619245d..dc1489a8f9bf2662b902eca9bae4a726ba70ffe1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Removed Travis CI `bin/` directory, along with all associated Travis CI configuration files and scripts. - Removed the functionality that retrieved the current commit hash of the checked out Git repository for the extension. The commit hash was previously inserted into a custom API resource to provide external developers repository information. - Removed `ckanext.odsh.home` configuration variable. +- The `tag_name_validator` function, responsible for validating tag names, has been removed. Tag names are no longer restricted by any validation checks, allowing for unrestricted input (according [DCAT-AP](https://www.dcat-ap.de/def/dcatde/2.0/spec/#datensatz-schlagwort)). ### Changed diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 998aac33f4511b34c52e6f00979abaccd3e4bb56..25cd8e1852c1dde80697de38b63b4db20a613016 100644 --- a/ckanext/odsh/plugin.py +++ b/ckanext/odsh/plugin.py @@ -157,10 +157,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ] }) - for i, item in enumerate(schema['tags']['name']): - if item == toolkit.get_validator('tag_name_validator'): - schema['tags']['name'][i] = toolkit.get_validator( - 'odsh_tag_name_validator') for i, item in enumerate(schema['tag_string']): if item == tag_string_convert: schema['tag_string'][i] = validation.tag_string_convert diff --git a/ckanext/odsh/tests/test_validation.py b/ckanext/odsh/tests/test_validation.py index c46d73af193dfc4a05ab9fb25cffeb8d9f7082a2..ea1912d0d6fcec4bf12519a153f9b4cbd9c6d8fb 100644 --- a/ckanext/odsh/tests/test_validation.py +++ b/ckanext/odsh/tests/test_validation.py @@ -53,15 +53,6 @@ def test_tag_string_convert(): assert data[('tags', 1, 'name')] == 'tag2' -def test_tag_name_validator_invalid(): - with pytest.raises(Exception): - tag_name_validator('&', None) - - -def test_tag_name_validator_valid(): - tag_name_validator('valid', None) - - @patch('urllib.request.urlopen') @patch('pylons.config.get', side_effect='foo') @patch('csv.reader', side_effect=[[['uri', 'text', json.dumps({"geometry": 0})]]]) diff --git a/ckanext/odsh/validation.py b/ckanext/odsh/validation.py index cb0574e40401bf6f3617e232d518157757369bc8..ba6cec3fc9a34fc7179693dcd7a7e14e8454cae0 100644 --- a/ckanext/odsh/validation.py +++ b/ckanext/odsh/validation.py @@ -273,14 +273,6 @@ def next_extra_index(data): return max(current_indexes) + 1 if current_indexes else 0 -def tag_name_validator(value, context): - tagname_match = re.compile(r'[\w \-.\:\(\)\´\`\§]*$', re.UNICODE) - if not tagname_match.match(value): - raise toolkit.Invalid(_('Tag "%s" must be alphanumeric ' - 'characters or symbols: -_.:()') % (value)) - return value - - def tag_string_convert(key, data, errors, context): '''Takes a list of tags that is a comma-separated string (in data[key]) and parses tag names. These are added to the data dict, enumerated. They @@ -300,7 +292,6 @@ def tag_string_convert(key, data, errors, context): for tag in tags: toolkit.get_validator('tag_length_validator')(tag, context) - tag_name_validator(tag, context) def _convert_subjectID_to_subjectText(subject_id, flattened_data): @@ -375,7 +366,6 @@ def validate_formats(data, errors): def get_validators(): return { 'known_spatial_uri': known_spatial_uri, - 'odsh_tag_name_validator': tag_name_validator, 'odsh_validate_extras': validate_extras, 'validate_licenseAttributionByText': validate_licenseAttributionByText, 'tpsh_validate_subject': validate_subject,