Skip to content
Snippets Groups Projects
Commit 1262abf7 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Remove tag_name_validator function and its usages

The tag_name_validator function, which enforced restrictions on tag names, has been completely removed from the codebase. This change allows for unrestricted tag names, removing any validation based on the regular expression pattern. The decision to remove this function was made to align with the desired behavior of not imposing any limitations on tag names.

This commit removes the tag_name_validator function and any code where it was called, ensuring that tag names are no longer subject to validation checks.
parent 007c1ae8
No related branches found
No related tags found
2 merge requests!48Merge dev into master,!43Remove tag_name_validator function and its usages
......@@ -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
......
......@@ -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
......
......@@ -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})]]])
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment