Search Resources in Dataset Read View Func#225
Open
JVickery-TBS wants to merge 2 commits intocanada-v2.10from
Open
Search Resources in Dataset Read View Func#225JVickery-TBS wants to merge 2 commits intocanada-v2.10from
JVickery-TBS wants to merge 2 commits intocanada-v2.10from
Conversation
- Dataset resource search view arg.
- Added change log file.
wardi
reviewed
Mar 20, 2026
| # TODO: upstream contrib?? | ||
| resource_query = request.args.get("resource_query") | ||
| if resource_query: | ||
| resource_query = html_escape(resource_query) |
Member
There was a problem hiding this comment.
This shouldn't be needed. Flask has already converted any url-encoded characters here and the resource name we're comparing against is not escaped.
Suggested change
| resource_query = html_escape(resource_query) |
wardi
reviewed
Mar 20, 2026
Comment on lines
+500
to
+506
| filtered_resources = [] | ||
| for res_dict in pkg_dict['resources']: | ||
| res_name = h.get_translated(res_dict, 'name') | ||
| if resource_query.lower() not in res_name.lower(): | ||
| continue | ||
| filtered_resources.append(res_dict) | ||
| pkg_dict['resources'] = filtered_resources |
Member
There was a problem hiding this comment.
If you want to save some steps and temporary variables:
Suggested change
| filtered_resources = [] | |
| for res_dict in pkg_dict['resources']: | |
| res_name = h.get_translated(res_dict, 'name') | |
| if resource_query.lower() not in res_name.lower(): | |
| continue | |
| filtered_resources.append(res_dict) | |
| pkg_dict['resources'] = filtered_resources | |
| pkg_dict['resources'] = [ | |
| r for r in pkg_dict['resources'] | |
| if resource_query.lower() in h.get_translated(r, 'name').lower() | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
feat(views): resource search;