Skip to content

Commit

Permalink
Fix PEP8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksandar Jovanov committed Jun 5, 2017
1 parent 57413ee commit d7de549
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 22 deletions.
4 changes: 1 addition & 3 deletions ckanext/requestdata/controllers/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
NotFound = logic.NotFound
NotAuthorized = logic.NotAuthorized

c = base.c
redirect = base.redirect
abort = base.abort

Expand Down Expand Up @@ -156,8 +155,7 @@ def requests_data(self):
package =\
_get_action('package_show', {'id': x['package_id']})
count = \
_get_action(
'requestdata_request_data_counters_get',
_get_action('requestdata_request_data_counters_get',
{'package_id': x['package_id']})
if count:
x['shared'] = count.shared
Expand Down
13 changes: 5 additions & 8 deletions ckanext/requestdata/controllers/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,7 @@ def requested_data(self, id):
package = \
_get_action('package_show', {'id': x['package_id']})
count = \
_get_action(
'requestdata_request_data_counters_get',
_get_action('requestdata_request_data_counters_get',
{'package_id': x['package_id']})
x['title'] = package['title']
x['shared'] = count.shared
Expand Down Expand Up @@ -219,14 +218,12 @@ def requested_data(self, id):
dataset.update(data)

if organ['name'] == q_organization:
grouped_requests_archive = sorted(
grouped_requests_archive,
key=lambda x: x[order],
reverse=reverse)
grouped_requests_archive = sorted(grouped_requests_archive,
key=lambda x: x[order],
reverse=reverse)

counters =\
_get_action(
'requestdata_request_data_counters_get_by_org',
_get_action('requestdata_request_data_counters_get_by_org',
{'org_id': organ['id']})

extra_vars = {
Expand Down
12 changes: 5 additions & 7 deletions ckanext/requestdata/controllers/request_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ def _get_email_configuration(
email_footer = email_footer.replace(avaiable_terms[i], new_terms[i])

if only_org_admins:
owner_org = _get_action(
'package_show',
owner_org = _get_action('package_show',
{'id': dataset_name}).get('owner_org')
url = toolkit.url_for('requestdata_organization_requests',
id=owner_org, qualified=True)
Expand Down Expand Up @@ -168,7 +167,7 @@ def send_request(self):
error = {
'success': False,
'error': {
'fields': e.error_dict
'fields': e.error_dict
}
}

Expand All @@ -178,7 +177,6 @@ def send_request(self):
package = _get_action('package_show', data_dict)
sender_name = data.get('sender_name', '')
user_obj = context['auth_user_obj']
user_name = user_obj.fullname
data_dict = {
'id': user_obj.id,
'permission': 'read'
Expand Down Expand Up @@ -261,9 +259,9 @@ def send_request(self):
'package_id': data['package_id'],
'flag': 'request'
}
_get_action(
'requestdata_increment_request_data_counters',
data_dict)

action_name = 'requestdata_increment_request_data_counters'
_get_action(action_name, data_dict)

return json.dumps(response_message)
else:
Expand Down
10 changes: 6 additions & 4 deletions ckanext/requestdata/controllers/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ def handle_new_request_action(self, username, request_action):
'success': True,
'message': 'Message was sent successfully'
}
get_action('requestdata_increment_request_data_counters')
({}, counters_data_dict)

action_name = 'requestdata_increment_request_data_counters'
_get_action(action_name, counters_data_dict)

return json.dumps(success)

Expand Down Expand Up @@ -302,8 +303,9 @@ def handle_open_request_action(self, username, request_action):
else:
data_dict['flag'] = 'declined'

get_action('requestdata_increment_request_data_counters')
({}, data_dict)
action_name = 'requestdata_increment_request_data_counters'
_get_action(action_name)(data_dict)

try:
_get_action('requestdata_request_patch', data)
except NotAuthorized:
Expand Down

0 comments on commit d7de549

Please sign in to comment.