Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Proof of concept for new config option: ckanext.xloader.site_url #234
base: master
Are you sure you want to change the base?
Proof of concept for new config option: ckanext.xloader.site_url #234
Changes from 1 commit
43203b8
da5c031
93c9e5f
deab5cb
729d5b3
03a4e67
4b64d4e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need an empty string default, it's normal for optional settings to be not present if not provided
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of the
toolkit.config.get("ckanext.xloader.site_url") or toolkit.config.get("ckan.site_url")
logic below we should be able to use justtoolkit.config.get("ckanext.xloader.site_url")
along with:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wardi ok I see. so that default is just set in the config yaml, and then, any code can assume that fallback default for the
ckanext.xloader.site_url
setting?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this validator will set
ckanext.xloader.site_url
to the same asckan.site_url
when it's not given. Another one of @smotornyuk 's clever ideas.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to bother with that when
jobs.py
already has the fallbackconfig.get('ckanext.xloader.site_url') or config.get('ckan.site_url')
?IMO we should keep the fallback in
jobs.py
in case someone manually setsckanext.xloader.site_url
to a blank value (which could happen if eg the config is being automatically generated/populated from somewhere, perhaps usingckanext-ssm-config
), so the validator approach is redundant.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ckan will refuse to start if a site_url isn't provided, so this code would never get executed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wardi here, I'm just extending the existing check for that. I prefer not to remove existing behavior, but just to provide the minimal new behavior required for the PR
https://github.com/ckan/ckanext-xloader/blob/master/ckanext/xloader/plugin.py#L64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you did not cleanup the error message, this would not have been commented upon ;)
I'm fine leaving this in as its a belts and braces approach, better to fail early (if it does occur which is very very remote)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
going to need more tests created to set these two values for proper validation.
one for default site url, another for the xloader override value. updating the fixture is so/so.