Skip to content
Snippets Groups Projects
Commit d96ae8e8 authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

Merge branch '48-keine-einschrankungen-bei-schlagworten' into 'dev'

Remove tag_name_validator function and its usages

See merge request !43
parents a22d17af cd2fd79b
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 ...@@ -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 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 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. - 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. - Removed `ckanext.odsh.upload_formats` configuration variable. Upload formats are now populated by EU-approved file formats.
### Changed ### Changed
......
...@@ -157,10 +157,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm ...@@ -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']): for i, item in enumerate(schema['tag_string']):
if item == tag_string_convert: if item == tag_string_convert:
schema['tag_string'][i] = validation.tag_string_convert schema['tag_string'][i] = validation.tag_string_convert
......
...@@ -53,15 +53,6 @@ def test_tag_string_convert(): ...@@ -53,15 +53,6 @@ def test_tag_string_convert():
assert data[('tags', 1, 'name')] == 'tag2' 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('urllib.request.urlopen')
@patch('pylons.config.get', side_effect='foo') @patch('pylons.config.get', side_effect='foo')
@patch('csv.reader', side_effect=[[['uri', 'text', json.dumps({"geometry": 0})]]]) @patch('csv.reader', side_effect=[[['uri', 'text', json.dumps({"geometry": 0})]]])
......
...@@ -274,14 +274,6 @@ def next_extra_index(data): ...@@ -274,14 +274,6 @@ def next_extra_index(data):
return max(current_indexes) + 1 if current_indexes else 0 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): def tag_string_convert(key, data, errors, context):
'''Takes a list of tags that is a comma-separated string (in data[key]) '''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 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): ...@@ -301,7 +293,6 @@ def tag_string_convert(key, data, errors, context):
for tag in tags: for tag in tags:
toolkit.get_validator('tag_length_validator')(tag, context) toolkit.get_validator('tag_length_validator')(tag, context)
tag_name_validator(tag, context)
def _convert_subjectID_to_subjectText(subject_id, flattened_data): def _convert_subjectID_to_subjectText(subject_id, flattened_data):
...@@ -376,7 +367,6 @@ def validate_formats(data, errors): ...@@ -376,7 +367,6 @@ def validate_formats(data, errors):
def get_validators(): def get_validators():
return { return {
'known_spatial_uri': known_spatial_uri, 'known_spatial_uri': known_spatial_uri,
'odsh_tag_name_validator': tag_name_validator,
'odsh_validate_extras': validate_extras, 'odsh_validate_extras': validate_extras,
'validate_licenseAttributionByText': validate_licenseAttributionByText, 'validate_licenseAttributionByText': validate_licenseAttributionByText,
'tpsh_validate_subject': validate_subject, '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