-
Notifications
You must be signed in to change notification settings - Fork 165
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
Config setting to add custom composite separator #295
base: master
Are you sure you want to change the base?
Conversation
pull updates from core repo
ckanext/scheming/helpers.py
Outdated
@@ -27,6 +27,9 @@ def lang(): | |||
from ckantoolkit import h | |||
return h.lang() | |||
|
|||
@helper | |||
def scheming_composite_separator(): | |||
return config.get('scheming.composite.separator','|') |
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.
Probably it would be better to keep this setting as the default '-' and override if needed.
Could this affect existing schemas? If so we should move this to the scheming yaml / json instead providing a per type setting. What do you think?
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.
good point about the default separator character. I have made that change. I don't think this will affect existing schemas, now that it is using the correct default separator char. A per field override is an interesting idea though. It would be a bit of work as everywhere the separator is used we would also need to check which field we are handling and check the schema. So far, my experience is that a global setting is meeting all our needs in cioos.
I'm testing it with the spatial plugin, and apart few changes (check comments in pull req), it looks working. |
here is it, just a supereasy fix to the js and a line in the documentation: |
ok, I merged in your pull request. thanks for adding the README update. It seems the 2.9 tests are failing but I can't seem to get the tests to run locally. not sure what the issue is there. |
I'm checking the error and it looks unrelated [#310], although I'm aligning the tests to better reflect the usage of the separator. This patch looks good (tested, worked) and it's very useful when spatial is involved so thank you! |
ok great. I think this is good to go then. Not sure who should review next and/or merge? |
While working with scheming, spatial, harvester, composite, and repeating extensions I noticed that the default separator of '-' for composite fields caused some problems. This was mostly due to the default field names in the spatial extension containing the same character. I had previously forked the composite extension and added a config setting to set the separator used on composite fields to a custom character.
Now that scheming supports this functionality directly I suggest adding a config setting to allow users to set the separator character to something other than a dash if needed. This pull request addresses this suggestion.
To use a custom separator character, add the
scheming.composite.separator
setting to your ckan.ini file.Fix #294