Use self.api i resources.
This commit is contained in:
parent
3a980262a0
commit
0cda88693f
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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']
|
||||
|
Loading…
Reference in New Issue
Block a user