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