Rename operation_id in id.

This commit is contained in:
Alexis Lahouze 2016-01-12 22:55:26 +01:00
parent 11d1c6d679
commit 1202c8180e

View File

@ -91,25 +91,25 @@ class ScheduledOperationListResource(Resource):
class ScheduledOperationResource(Resource):
@marshal_with_field(Object(resource_fields))
def get(self, scheduled_operation_id):
def get(self, id):
"""
Get scheduled operation.
"""
try:
return ScheduledOperation.query().filter(
ScheduledOperation.id == scheduled_operation_id
ScheduledOperation.id == id
).one()
except NoResultFound:
return None, 404
@marshal_with_field(Object(resource_fields))
def delete(self, scheduled_operation_id):
def delete(self, id):
"""
Delete a scheduled operation.
"""
try:
scheduled_operation = ScheduledOperation.query().filter(
ScheduledOperation.id == scheduled_operation_id
ScheduledOperation.id == id
).one()
except NoResultFound:
return None, 404
@ -132,18 +132,18 @@ class ScheduledOperationResource(Resource):
return None, 204
@marshal_with_field(Object(resource_fields))
def post(self, scheduled_operation_id):
def post(self, id):
"""
Update a scheduled operation.
"""
kwargs = parser.parse_args()
assert (id not in kwargs or kwargs.id is None
or kwargs.id == scheduled_operation_id)
or kwargs.id == id)
try:
scheduled_operation = ScheduledOperation.query().filter(
ScheduledOperation.id == scheduled_operation_id
ScheduledOperation.id == id
).one()
except NoResultFound:
return None, 404
@ -163,4 +163,4 @@ class ScheduledOperationResource(Resource):
api_api.add_resource(ScheduledOperationListResource, "/scheduled_operations")
api_api.add_resource(ScheduledOperationResource,
"/scheduled_operations/<int:scheduled_operation_id>")
"/scheduled_operations/<int:id>")