diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b1ccf60d7a809db0ea3f6064f56c6a9667328cd..738d27057f95c520419f2c05450ccba2a58b97d2 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)). - Removed `ckanext.odsh.upload_formats` configuration variable. Upload formats are now populated by EU-approved file formats. ### Changed diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py index 2d6a771ba06123a0bba3e8e4515dc45aa66062a0..a1f94235947df9e285ae47cb1f3406412c0dcc0f 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 9b329f0317073eb21ccfb07020b21e8da8f3dc01..2bbee66b6b417b62a1c46cbb7f9a551d1da5a696 100644 --- a/ckanext/odsh/validation.py +++ b/ckanext/odsh/validation.py @@ -274,14 +274,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 @@ -301,7 +293,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): @@ -376,7 +367,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,