Skip to content

Commit

Permalink
[1608] Cleaned up revision message (removed None) and allow resource …
Browse files Browse the repository at this point in the history
…owners to update them.
  • Loading branch information
rossjones committed Jan 10, 2012
1 parent 69792aa commit 8c1a7c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ckan/logic/action/update.py
Expand Up @@ -166,6 +166,7 @@ def resource_update(context, data_dict):
context["resource"] = resource

if not resource:
logging.error('Could not find resource ' + id)
raise NotFound(_('Resource was not found.'))

check_access('resource_update', context, data_dict)
Expand All @@ -181,7 +182,7 @@ def resource_update(context, data_dict):
if 'message' in context:
rev.message = context['message']
else:
rev.message = _(u'REST API: Update object %s') % data.get("name")
rev.message = _(u'REST API: Update object %s') % data.get("name", "")

resource = resource_dict_save(data, context)
if not context.get('defer_commit'):
Expand Down
5 changes: 3 additions & 2 deletions ckan/logic/auth/update.py
Expand Up @@ -159,8 +159,9 @@ def task_status_update(context, data_dict):
id = data_dict.get('entity_id',None)
resource = model.Resource.get(id)

if resource.revision.author == user:
return {'success': True}
if resource and resource.revision:
if resource.revision.author == user:
return {'success': True}

authorized = Authorizer().is_sysadmin(unicode(user))
if not authorized:
Expand Down

0 comments on commit 8c1a7c6

Please sign in to comment.