diff --git a/ckanext/canada/helpers.py b/ckanext/canada/helpers.py index ddc3b5a8b..99068603a 100755 --- a/ckanext/canada/helpers.py +++ b/ckanext/canada/helpers.py @@ -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 @@ -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 diff --git a/ckanext/canada/plugins.py b/ckanext/canada/plugins.py index 076ddfa8b..a8de9225e 100755 --- a/ckanext/canada/plugins.py +++ b/ckanext/canada/plugins.py @@ -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', ])