Skip to content

Commit

Permalink
[#1208] Allow users to not request the dataset listing on group_show
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader authored and wardi committed Feb 20, 2014
1 parent 612f699 commit 037e11e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ckan/controllers/group.py
Expand Up @@ -182,7 +182,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:
Expand Down Expand Up @@ -377,7 +377,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:
Expand Down
6 changes: 3 additions & 3 deletions ckan/lib/dictization/model_dictize.py
Expand Up @@ -328,14 +328,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

Expand All @@ -351,7 +351,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']
Expand Down
9 changes: 9 additions & 0 deletions ckan/logic/action/get.py
Expand Up @@ -879,6 +879,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

Expand Down Expand Up @@ -923,6 +926,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
Expand All @@ -936,6 +942,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
Expand Down

0 comments on commit 037e11e

Please sign in to comment.