From cb86fc3680e3fba767a559f4f0c779af389e3473 Mon Sep 17 00:00:00 2001 From: Alexis Lahouze Date: Tue, 12 Jan 2016 22:51:50 +0100 Subject: [PATCH] Rename account_id in id. --- accountant/api/views/accounts.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/accountant/api/views/accounts.py b/accountant/api/views/accounts.py index 84b803f..14c51a2 100644 --- a/accountant/api/views/accounts.py +++ b/accountant/api/views/accounts.py @@ -95,7 +95,7 @@ class AccountListResource(Resource): class AccountResource(Resource): @requires_auth @marshal_with_field(Object(resource_fields)) - def get(self, account_id): + def get(self, id): """ Get account. """ @@ -105,16 +105,16 @@ class AccountResource(Resource): return Account.query( **kwargs ).filter( - Account.id == account_id + Account.id == id ).one() except NoResultFound: return None, 404 @requires_auth @marshal_with_field(Object(resource_fields)) - def delete(self, account_id): + def delete(self, id): # Need to get the object to update it. - account = db.session.query(Account).get(account_id) + account = db.session.query(Account).get(id) if not account: return None, 404 @@ -125,14 +125,14 @@ class AccountResource(Resource): @requires_auth @marshal_with_field(Object(resource_fields)) - def post(self, account_id): + def post(self, id): kwargs = parser.parse_args() assert (id not in kwargs or kwargs.id is None - or kwargs.id == account_id) + or kwargs.id == id) # Need to get the object to update it. - account = db.session.query(Account).get(account_id) + account = db.session.query(Account).get(id) if not account: return None, 404 @@ -145,12 +145,12 @@ class AccountResource(Resource): # Return account with solds. return Account.query().filter( - Account.id == account_id + Account.id == id ).one() api_api.add_resource(AccountListResource, '/accounts') -api_api.add_resource(AccountResource, '/accounts/') +api_api.add_resource(AccountResource, '/accounts/') range_parser = reqparse.RequestParser()