diff --git a/accountant/views/accounts.py b/accountant/views/accounts.py index 0f17e4b..c3c2a2e 100644 --- a/accountant/views/accounts.py +++ b/accountant/views/accounts.py @@ -158,7 +158,7 @@ class AccountListResource(Resource): def post(self): """Create a new account.""" - data = ns.apis[0].payload + data = self.api.payload # A new account MUST NOT have an id; if 'id' in data and data['id']: @@ -219,7 +219,7 @@ class AccountResource(Resource): def post(self, id): """Update an account.""" - data = ns.apis[0].payload + data = self.api.payload # Check ID consistency. if 'id' in data and data['id'] and data['id'] != id: diff --git a/accountant/views/operations.py b/accountant/views/operations.py index 42ad4b4..52224c7 100644 --- a/accountant/views/operations.py +++ b/accountant/views/operations.py @@ -136,7 +136,7 @@ class OperationListResource(Resource): def post(self): """Create a new operation.""" - data = ns.apis[0].payload + data = self.api.payload account_id = data['account_id'] account = Account.query().get(account_id) @@ -198,7 +198,7 @@ class OperationResource(Resource): def post(self, id): """Update an operation.""" - data = ns.apis[0].payload + data = self.api.payload # Check ID consistency. if 'id' in data and data['id'] and data['id'] != id: diff --git a/accountant/views/scheduled_operations.py b/accountant/views/scheduled_operations.py index e104815..3d0f83f 100644 --- a/accountant/views/scheduled_operations.py +++ b/accountant/views/scheduled_operations.py @@ -109,7 +109,7 @@ class ScheduledOperationListResource(Resource): def post(self): """Add a new scheduled operation.""" - data = ns.apis[0].payload + data = self.api.payload account_id = data['account_id'] account = Account.query().get(account_id) @@ -175,7 +175,7 @@ class ScheduledOperationResource(Resource): def post(self, id): """Update a scheduled operation.""" - data = ns.apis[0].payload + data = self.api.payload # Check ID consistency. if 'id' in data and data['id'] and data['id'] != id: diff --git a/accountant/views/users.py b/accountant/views/users.py index 3b5ca2d..2ff1c20 100644 --- a/accountant/views/users.py +++ b/accountant/views/users.py @@ -128,7 +128,7 @@ class LoginResource(Resource): def post(self): """Login to retrieve authentication token.""" - data = ns.apis[0].payload + data = self.api.payload user = User.query().filter( User.email == data['email']