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

Get the DEFAULT_FORMATS from the ini file #8095

Merged
merged 3 commits into from
Mar 11, 2024
Merged
Changes from 2 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
20 changes: 18 additions & 2 deletions ckan/cli/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,22 @@
get_default_view_plugins,
)

tk = p.toolkit

_page_size = 100

DEFAULT_FORMATS = [
u'csv',
u'xls',
u'xlsx',
u'tsv',
u'application/csv',
u'application/vnd.ms-excel',
u'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
u'ods',
u'application/vnd.oasis.opendocument.spreadsheet',
]


@click.group(short_help=u"Manage resource views.")
def views():
Expand Down Expand Up @@ -258,7 +271,7 @@ def _search_datasets(
if not search_data_dict.get(u"q"):
search_data_dict[u"q"] = u"*:*"

query = p.toolkit.get_action(u"package_search")({}, search_data_dict)
query = tk.get_action(u"package_search")({}, search_data_dict)

return query

Expand All @@ -284,7 +297,9 @@ def _add_default_filters(search_data_dict, view_types):

from ckanext.imageview.plugin import DEFAULT_IMAGE_FORMATS
from ckanext.textview.plugin import get_formats as get_text_formats
from ckanext.datapusher.plugin import DEFAULT_FORMATS as datapusher_formats

datapusher_formats = tk.aslist(
tk.config.get("ckan.datapusher.formats")) or DEFAULT_FORMATS

filter_formats = []

Expand All @@ -307,6 +322,7 @@ def _add_default_filters(search_data_dict, view_types):
u"recline_grid_view",
u"recline_graph_view",
u"recline_map_view",
u"datatablesplus_view",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the datatablesplus_view ? Shouldn't this be datatables_view?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ups, i tell the secret im working on :)
thanks i missed it while testing

]:

if datapusher_formats[0] in filter_formats:
Expand Down