From 2ab10afcf92a16f239f6cd86f26f9cebd5bae865 Mon Sep 17 00:00:00 2001 From: amercader Date: Wed, 16 Jan 2013 12:56:58 +0000 Subject: [PATCH] [#4] Fix typo in auth functions --- ckanext/harvest/logic/auth/create.py | 5 ++--- ckanext/harvest/logic/auth/delete.py | 2 +- ckanext/harvest/logic/auth/get.py | 2 +- ckanext/harvest/logic/auth/update.py | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/ckanext/harvest/logic/auth/create.py b/ckanext/harvest/logic/auth/create.py index 984f489..03aa01b 100644 --- a/ckanext/harvest/logic/auth/create.py +++ b/ckanext/harvest/logic/auth/create.py @@ -14,7 +14,7 @@ def harvest_source_create(context, data_dict): try: pt.check_access('package_create', context, data_dict) return {'success': True} - except pt.Not_Authorized: + except pt.NotAuthorized: return {'success': False, 'msg': pt._('User {0} not authorized to create harvest sources').format(user)} @@ -34,11 +34,10 @@ def harvest_job_create(context, data_dict): raise pt.ObjectNotFound(pt._('Harvest source not found')) context['package'] = pkg - try: pt.check_access('package_update', context, data_dict) return {'success': True} - except pt.Not_Authorized: + except pt.NotAuthorized: return {'success': False, 'msg': pt._('User not authorized to create a job for source {0}').format(source_id)} diff --git a/ckanext/harvest/logic/auth/delete.py b/ckanext/harvest/logic/auth/delete.py index 249fad4..f364ab4 100644 --- a/ckanext/harvest/logic/auth/delete.py +++ b/ckanext/harvest/logic/auth/delete.py @@ -22,6 +22,6 @@ def harvest_source_update(context, data_dict): try: pt.check_access('package_delete', context, data_dict) return {'success': True} - except pt.Not_Authorized: + except pt.NotAuthorized: return {'success': False, 'msg': pt._('User {0} not authorized to delete harvest source {1}').format(user, source_id)} diff --git a/ckanext/harvest/logic/auth/get.py b/ckanext/harvest/logic/auth/get.py index f2119a6..d540c5b 100644 --- a/ckanext/harvest/logic/auth/get.py +++ b/ckanext/harvest/logic/auth/get.py @@ -23,7 +23,7 @@ def harvest_source_show(context, data_dict): try: pt.check_access('package_show', context, data_dict) return {'success': True} - except pt.Not_Authorized: + except pt.NotAuthorized: return {'success': False, 'msg': pt._('User {0} not authorized to read harvest source {1}').format(user, source_id)} diff --git a/ckanext/harvest/logic/auth/update.py b/ckanext/harvest/logic/auth/update.py index 162299c..a5bf31b 100644 --- a/ckanext/harvest/logic/auth/update.py +++ b/ckanext/harvest/logic/auth/update.py @@ -23,7 +23,7 @@ def harvest_source_update(context, data_dict): try: pt.check_access('package_update', context, data_dict) return {'success': True} - except pt.Not_Authorized: + except pt.NotAuthorized: return {'success': False, 'msg': pt._('User {0} not authorized to update harvest source {1}').format(user, source_id)}