Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display publisher as multilang #339

Merged
merged 13 commits into from
Jan 6, 2025
Merged

Display publisher as multilang #339

merged 13 commits into from
Jan 6, 2025

Conversation

kovalch
Copy link
Contributor

@kovalch kovalch commented Dec 16, 2024

No description provided.

ckanext/switzerland/helpers/dataset_form_helpers.py Outdated Show resolved Hide resolved
ckanext/switzerland/helpers/dataset_form_helpers.py Outdated Show resolved Hide resolved
Comment on lines 352 to 353
elif isinstance(data.get(key), dict):
data[key] = json.dumps(data.get(key))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Building on what @stefina said above, I think you can move this case to the start of the function and remove one level of the nesting of the logic. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, please check

ckanext/switzerland/helpers/validators.py Outdated Show resolved Hide resolved
if isinstance(data.get(key), dict):
data[key] = json.dumps(data.get(key))
return # exit early since this case is handled
# the key is missing
if not data.get(key):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove this if statement and un-indent everything beneath it by one tab

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would not do this, actually I would remove

if isinstance(data.get(key), dict):
            data[key] = json.dumps(data.get(key))
            return

And really validate the missing value here. If we will remove if not data.get(key)
It could lead to overwriting valid data, like str value (from foaf:Organization).

@kovalch kovalch merged commit 4c7724c into master Jan 6, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants