diff --git a/ckan/controllers/group.py b/ckan/controllers/group.py index 060d99b45ca..f5880ff7a65 100644 --- a/ckan/controllers/group.py +++ b/ckan/controllers/group.py @@ -180,7 +180,7 @@ def read(self, id, limit=20): try: # Do not query for the group datasets when dictizing, as they will # be ignored and get requested on the controller anyway - context['include_group_packages'] = False + context['include_datasets'] = False c.group_dict = self._action('group_show')(context, data_dict) c.group = context['group'] except NotFound: @@ -375,7 +375,7 @@ def bulk_process(self, id): try: # Do not query for the group datasets when dictizing, as they will # be ignored and get requested on the controller anyway - context['include_group_packages'] = False + context['include_datasets'] = False c.group_dict = self._action('group_show')(context, data_dict) c.group = context['group'] except NotFound: diff --git a/ckan/lib/dictization/model_dictize.py b/ckan/lib/dictization/model_dictize.py index e4ab1d24467..e1603d2e52b 100644 --- a/ckan/lib/dictization/model_dictize.py +++ b/ckan/lib/dictization/model_dictize.py @@ -349,14 +349,14 @@ def group_dictize(group, context): context['with_capacity'] = True - include_packages = context.get('include_group_packages', True) + include_datasets = context.get('include_datasets', True) q = { 'facet': 'false', 'rows': 0, } - if include_packages: + if include_datasets: q['rows'] = 1000 # Only the first 1000 datasets are returned @@ -372,7 +372,7 @@ def group_dictize(group, context): search_results = logic.get_action('package_search')(context, q) - if include_packages: + if include_datasets: result_dict['packages'] = search_results['results'] result_dict['package_count'] = search_results['count'] diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 39d7278d89d..71132716b68 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -944,6 +944,9 @@ def _group_or_org_show(context, data_dict, is_org=False): group = model.Group.get(id) context['group'] = group + context['include_datasets'] = ( + data_dict.get('include_datasets','true').lower() in ('true', '1')) + if group is None: raise NotFound if is_org and not group.is_organization: @@ -990,6 +993,9 @@ def group_show(context, data_dict): :param id: the id or name of the group :type id: string + :param include_datasets: include a list of the group's datasets + (optional, default: ``True``) + :type id: boolean :rtype: dictionary @@ -1003,6 +1009,9 @@ def organization_show(context, data_dict): :param id: the id or name of the organization :type id: string + :param include_datasets: include a list of the organization's datasets + (optional, default: ``True``) + :type id: boolean :rtype: dictionary