Skip to content

Commit

Permalink
fix(helpers): purge types;
Browse files Browse the repository at this point in the history
- Valid purge types helper.
  • Loading branch information
JVickery-TBS committed Oct 25, 2024
1 parent 989ca4b commit 83a9a9b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions ckanext/canada/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import html
from six import text_type
from bs4 import BeautifulSoup
from ckan import plugins

from ckanapi import NotFound
from ckantoolkit import aslist
Expand Down Expand Up @@ -908,3 +909,19 @@ def is_user_locked(user_name):
return True

return False


def available_purge_types():
"""
Returns a list of available purge types.
"""
types = []
for plugin in plugins.PluginImplementations(plugins.IDatasetForm):
for package_type in plugin.package_types():
if package_type not in types:
types.append(package_type)
for plugin in plugins.PluginImplementations(plugins.IGroupForm):
for group_types in plugin.group_types():
if group_types not in types:
types.append(group_types)
return types
1 change: 1 addition & 0 deletions ckanext/canada/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ def get_helpers(self):
'search_filter_pill_link_label',
'release_date_facet_start_year',
'ckan_to_cdts_breadcrumbs',
'available_purge_types',
])


Expand Down

0 comments on commit 83a9a9b

Please sign in to comment.