From 16979bfc0bd725391d792d95ccdd655b8395555b Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Fri, 7 Jul 2017 17:39:21 +0200 Subject: [PATCH] Fix data.get with default. --- accountant/views/accounts.py | 2 +- accountant/views/operations.py | 2 +- accountant/views/scheduled_operations.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/accountant/views/accounts.py b/accountant/views/accounts.py index 89e8fa2..2bc54b6 100644 --- a/accountant/views/accounts.py +++ b/accountant/views/accounts.py @@ -205,7 +205,7 @@ class AccountResource(Resource): data = self.api.payload # Check ID consistency. - if data.get('id', default=account_id) != account_id: + if data.get('id', account_id) != account_id: ns.abort(406, 'Id must not be provided or changed on update.') # Need to get the object to update it. diff --git a/accountant/views/operations.py b/accountant/views/operations.py index 68a4e81..8511993 100644 --- a/accountant/views/operations.py +++ b/accountant/views/operations.py @@ -185,7 +185,7 @@ class OperationResource(Resource): data = self.api.payload # Check ID consistency. - if data.get('id', default=operation_id) != operation_id: + if data.get('id', operation_id) != operation_id: ns.abort(406, 'Id must not be provided or changed on update.') # pylint: disable=no-member diff --git a/accountant/views/scheduled_operations.py b/accountant/views/scheduled_operations.py index 44ad313..5f4d07b 100644 --- a/accountant/views/scheduled_operations.py +++ b/accountant/views/scheduled_operations.py @@ -160,7 +160,7 @@ class ScheduledOperationResource(Resource): so_id = scheduled_operation_id # Check ID consistency. - if data.get('id', default=so_id) != so_id: + if data.get('id', so_id) != so_id: ns.abort(406, 'Id must not be provided or changed on update.') scheduled_operation = ScheduledOperation.query().get(so_id)