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