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

Config setting to add custom composite separator #295

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

fostermh
Copy link

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

@@ -27,6 +27,9 @@ def lang():
from ckantoolkit import h
return h.lang()

@helper
def scheming_composite_separator():
return config.get('scheming.composite.separator','|')
Copy link
Contributor

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?

Copy link
Author

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.

@ccancellieri
Copy link
Contributor

I'm testing it with the spatial plugin, and apart few changes (check comments in pull req), it looks working.

@ccancellieri
Copy link
Contributor

Hi so in short it's a very good Idea,
I'm testing on my iso19115 and looks a good improvement.

I've still a problem on subfields of type multifield.

That button was not working due to an issue with the new character on the js.

image

I'll send a pull req to you so you can integrate in this pull req.

@ccancellieri
Copy link
Contributor

here is it, just a supereasy fix to the js and a line in the documentation:

cioos-siooc#2

@fostermh
Copy link
Author

fostermh commented Nov 1, 2021

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.

@ccancellieri
Copy link
Contributor

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!

@fostermh
Copy link
Author

fostermh commented Dec 2, 2021

ok great. I think this is good to go then. Not sure who should review next and/or merge?

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.

Default composite separator conflicts with spatial extension
2 participants