diff --git a/README.md b/README.md index 6a9dbff5..c759dced 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ If you set max_strikes then users can 'report' a comment as spam/abuse. If the n By default, issues are enabled for all datasets. If you wish to restrict issues to specific datasets or organizations, you can use these config options: - + ckanext.issues.enabled_for_datasets = mydataset1 mydataset2 ... ckanext.issues.enabled_for_organizations = department-of-transport health-regulator @@ -91,7 +91,7 @@ and you can set the default for all the other datasets (without that extra field ckanext.issues.enabled_without_extra = false -For the extra field to work you must not set `enabled_per_dataset` or `enabled_for_organizations` options. +For the extra field to work you must not set `enabled_for_datasets` or `enabled_for_organizations` options. ## Feedback diff --git a/ckanext/issues/auth.py b/ckanext/issues/auth.py index 3f84cfdb..b7fbbece 100644 --- a/ckanext/issues/auth.py +++ b/ckanext/issues/auth.py @@ -2,6 +2,8 @@ import ckan.plugins as p from ckanext.issues import model as issue_model +_ = p.toolkit._ + def issue_auth(context, data_dict, privilege='package_update'): '''Returns whether the current user is allowed to do the action @@ -15,12 +17,11 @@ def issue_auth(context, data_dict, privilege='package_update'): except p.toolkit.NotAuthorized: return { 'success': False, - 'msg': p.toolkit._( - 'User {0} not authorized for action on issue {1}'.format( - str(context['user']), - auth_data_dict['id'] - ) - ) + 'msg': _( + 'User {user} not authorized for action on issue {issue}' + ).format( + user=str(context['user']), + issue=auth_data_dict['id']) } @@ -37,10 +38,8 @@ def issue_search(context, data_dict): except p.toolkit.NotAuthorized: return { 'success': False, - 'msg': p.toolkit._( - 'User {0} not authorized for action'.format( - str(context['user']) - ) + 'msg': _('User {0} not authorized for action').format( + str(context['user']) ) } @@ -86,7 +85,7 @@ def issue_update(context, data_dict): # all other cases not allowed return { 'success': False, - 'msg': p.toolkit._( + 'msg': _( 'User {user} not authorized for action on issue {issue}'.format( user=str(user), issue=data_dict['issue_number'])