From e80e45e84b38179e5c44cbb5494f5e536497e846 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 4 Dec 2013 11:57:25 +0000 Subject: [PATCH] [#1359] Add organization_revision_list to avoid exception on org history page --- ckan/logic/action/get.py | 30 ++++++++++++++++++++++++++++-- ckan/logic/auth/get.py | 3 +++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/ckan/logic/action/get.py b/ckan/logic/action/get.py index 21612765a48..e4ee674b166 100644 --- a/ckan/logic/action/get.py +++ b/ckan/logic/action/get.py @@ -551,7 +551,8 @@ def organization_list_for_user(context, data_dict): orgs_list = model_dictize.group_list_dictize(orgs_q.all(), context) return orgs_list -def group_revision_list(context, data_dict): + +def _group_or_org_revision_list(context, data_dict): '''Return a group's revisions. :param id: the name or id of the group @@ -566,7 +567,6 @@ def group_revision_list(context, data_dict): if group is None: raise NotFound - _check_access('group_revision_list',context, data_dict) revision_dicts = [] for revision, object_revisions in group.all_related_revisions: @@ -575,6 +575,32 @@ def group_revision_list(context, data_dict): include_groups=False)) return revision_dicts +def group_revision_list(context, data_dict): + '''Return a group's revisions. + + :param id: the name or id of the group + :type id: string + + :rtype: list of dictionaries + + ''' + + _check_access('group_revision_list',context, data_dict) + return _group_or_org_revision_list(context, data_dict) + +def organization_revision_list(context, data_dict): + '''Return an organization's revisions. + + :param id: the name or id of the organization + :type id: string + + :rtype: list of dictionaries + + ''' + + _check_access('organization_revision_list',context, data_dict) + return _group_or_org_revision_list(context, data_dict) + def license_list(context, data_dict): '''Return the list of licenses available for datasets on the site. diff --git a/ckan/logic/auth/get.py b/ckan/logic/auth/get.py index c00624bb5d6..37de61d975a 100644 --- a/ckan/logic/auth/get.py +++ b/ckan/logic/auth/get.py @@ -39,6 +39,9 @@ def revision_list(context, data_dict): def group_revision_list(context, data_dict): return group_show(context, data_dict) +def organization_revision_list(context, data_dict): + return group_show(context, data_dict) + def package_revision_list(context, data_dict): return package_show(context, data_dict)