Fix data.get with default.

This commit is contained in:
Alexis Lahouze 2017-07-07 17:39:21 +02:00
parent 892470bdad
commit 16979bfc0b
3 changed files with 3 additions and 3 deletions

View File

@ -205,7 +205,7 @@ class AccountResource(Resource):
data = self.api.payload data = self.api.payload
# Check ID consistency. # 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.') ns.abort(406, 'Id must not be provided or changed on update.')
# Need to get the object to update it. # Need to get the object to update it.

View File

@ -185,7 +185,7 @@ class OperationResource(Resource):
data = self.api.payload data = self.api.payload
# Check ID consistency. # 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.') ns.abort(406, 'Id must not be provided or changed on update.')
# pylint: disable=no-member # pylint: disable=no-member

View File

@ -160,7 +160,7 @@ class ScheduledOperationResource(Resource):
so_id = scheduled_operation_id so_id = scheduled_operation_id
# Check ID consistency. # 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.') ns.abort(406, 'Id must not be provided or changed on update.')
scheduled_operation = ScheduledOperation.query().get(so_id) scheduled_operation = ScheduledOperation.query().get(so_id)