Change query for single object queries.

This commit is contained in:
Alexis Lahouze 2015-07-19 00:50:28 +02:00
parent c7521b67e6
commit 7d63176e7e

View File

@ -84,7 +84,7 @@ class OperationListResource(Resource):
session.add(operation)
return Operation.query(session).get(operation.id)
return operation
class OperationResource(Resource):
@ -94,7 +94,7 @@ class OperationResource(Resource):
"""
Get operation.
"""
operation = Operation.query(session).get(operation_id)
operation = session.query(Operation).get(operation_id)
if not operation:
return None, 404
@ -109,7 +109,7 @@ class OperationResource(Resource):
assert (id not in kwargs or kwargs.id is None
or kwargs.id == operation_id)
operation = Operation.query(session).get(operation_id)
operation = session.query(Operation).get(operation_id)
if not operation:
return None, 404
@ -125,7 +125,7 @@ class OperationResource(Resource):
@session_aware
@marshal_with_field(Object(resource_fields))
def delete(self, operation_id, session):
operation = Operation.query(session).get(operation_id)
operation = session.query(Operation).get(operation_id)
if not operation:
return None, 404