Fix schema error & in turn per-suite UI data provision #3217
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.
These changes partially address #3216 (the table that is not rendered returns, populated with the suite's data, but the GraphQL error on 'state' is still there & needs further investigation).
This PR essentially reverts #3211 (bar one line), because whilst
not X
to test for a sequence being non-empty in a conditional is the Pythonic way advocated by PEP8, in this context the logic onfield_ids
needs to distinguish between an empty list &None
(which that form does not do, as both are "falsy").This is because
field_ids = getattr(root, field_name, None)
returnsNone
as the default, & seems to be doing so for all the suites I have tried out to test this (as observed by adding in aprint()
function to check), whereas the query field argument default is an empty list (e.g. as here).However, for the remaining line from the one commit of that PR, it is safe to use a
not X
construct forworkflows
asX
becauseif workflows is None:
is explicitly tested in the previous statement, which itself cannot return aNone
value:https://github.com/kinow/cylc-flow/blob/67199ccc5c7abaa4f162f221e796adf5c5c83bc2/cylc/flow/network/schema.py#L699-L706
hence that line is safe & good.
Requirements check-list
CONTRIBUTING.md
and added my name as a Code Contributor.