-
Notifications
You must be signed in to change notification settings - Fork 138
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
694: search and pulldata secondary instance conflict #697
Conversation
- search appearance was recently changed to use a secondary instance, to avoid the issue of missing translations. However the secondary instance can result in name clashes. This can be avoided by changing the search() select's list name to something that doesn't clash, but anyway the secondary instance is redundant so it is now not emitted. - for two unsupported use cases, an error is now raised: - search appearance on a select_from_file - search appearance choice list used in other selects - add: tests for interactions with other ways of triggering secondary instances e.g. pulldata, external xml/csv, select_from_file, search. - chg: add constant for "list_name" and replace strings with it.
- add: tests for some settings that had no tests before, or were not well tested, or used XLS / JSON fixtures - chg: move NSMAP constant into constants module
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.
Hurray, that turned out not to be too bad and some nice cleanup with it too! 🎉 🙏
One message to change and a comment to consider updating as well but other than that it looks ready to me.
I don't think either of these has reasonable expected behavior and errors are an improvement. 👍 |
Filed settings docs issue at XLSForm/xlsform.github.io#266 |
199a6dc
to
e008ffd
Compare
Thanks! |
Closes #694
Why is this the best possible solution? Were any other approaches considered?
The previous solution for search + translations was pretty close, but created the possibility of conflicts in the secondary instances. This PR removes the secondary instance that would have been emitted. It also raises an error two search feature combinations that are not supported, and even if they were, would be broken by this PR's strategy (see tests for examples, where
errored=True
). These combinations are: 1) search appearance on a select_from_file, 2) search appearance choice list used in other selects.An alternative detailed in #694 was to merge compatible secondary instances, but @lognaturel clarified offline that this wouldn't work because the
src
attribute is how Collect/Enketo identify external instances. So having choices in a secondary instances with a non-blanksrc
wouldn't work.What are the regression risks?
If users had forms which included the above 2 scenarios which now raise an error, they would need to fix up their form. If the error seems to harsh maybe a warning could be emitted, but ODK Validate raises an ugly error for these cases anyway (due to missing instance).
Does this change require updates to documentation? If so, please file an issue here and include the link below.
I tidied up and included some settings tests I wrote for recent forum issues. These settings could be included in the XLSForm reference template.
Before submitting this PR, please make sure you have:
tests
python -m unittest
and verified all tests passruff format pyxform tests
andruff check pyxform tests
to lint code