Skip to content

Commit

Permalink
[#1359] Add organization_revision_list to avoid exception on org hist…
Browse files Browse the repository at this point in the history
…ory page
  • Loading branch information
amercader committed Dec 4, 2013
1 parent 82cdbb8 commit e80e45e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
30 changes: 28 additions & 2 deletions ckan/logic/action/get.py
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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.
Expand Down
3 changes: 3 additions & 0 deletions ckan/logic/auth/get.py
Expand Up @@ -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)

Expand Down

0 comments on commit e80e45e

Please sign in to comment.