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

Views Create CLI Sub-Command Fixes #7944

Merged
merged 2 commits into from Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/7944.bugfix
@@ -0,0 +1 @@
Fixed issues with the `ckan views create` CLI sub-command.
8 changes: 5 additions & 3 deletions ckan/cli/views.py
Expand Up @@ -61,7 +61,8 @@ def create(ctx: click.Context, types: list[str], dataset: list[str],
page = 1
while True:
query = _search_datasets(
page, loaded_view_plugins, dataset, search, no_default_filters
context, page, loaded_view_plugins,
dataset, search, no_default_filters
)
if query is None:
return
Expand Down Expand Up @@ -222,6 +223,7 @@ def _get_view_plugins(view_plugin_types: list[str],


def _search_datasets(
context: Context,
page: int = 1, view_types: Optional[list[str]] = None,
dataset: Optional[list[str]] = None, search: str = u"",
no_default_filters: bool = False
Expand Down Expand Up @@ -262,12 +264,12 @@ def _search_datasets(

elif not no_default_filters:

_add_default_filters(search_data_dict, view_types)
search_data_dict = _add_default_filters(search_data_dict, view_types)

if not search_data_dict.get(u"q"):
search_data_dict[u"q"] = u"*:*"

query = logic.get_action(u"package_search")({}, search_data_dict)
query = logic.get_action(u"package_search")(context, search_data_dict)

return query

Expand Down