Use self.api i resources.
This commit is contained in:
parent
3a980262a0
commit
0cda88693f
@ -158,7 +158,7 @@ class AccountListResource(Resource):
|
|||||||
def post(self):
|
def post(self):
|
||||||
"""Create a new account."""
|
"""Create a new account."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
# A new account MUST NOT have an id;
|
# A new account MUST NOT have an id;
|
||||||
if 'id' in data and data['id']:
|
if 'id' in data and data['id']:
|
||||||
@ -219,7 +219,7 @@ class AccountResource(Resource):
|
|||||||
def post(self, id):
|
def post(self, id):
|
||||||
"""Update an account."""
|
"""Update an account."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
# Check ID consistency.
|
# Check ID consistency.
|
||||||
if 'id' in data and data['id'] and data['id'] != id:
|
if 'id' in data and data['id'] and data['id'] != id:
|
||||||
|
@ -136,7 +136,7 @@ class OperationListResource(Resource):
|
|||||||
def post(self):
|
def post(self):
|
||||||
"""Create a new operation."""
|
"""Create a new operation."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
account_id = data['account_id']
|
account_id = data['account_id']
|
||||||
account = Account.query().get(account_id)
|
account = Account.query().get(account_id)
|
||||||
@ -198,7 +198,7 @@ class OperationResource(Resource):
|
|||||||
def post(self, id):
|
def post(self, id):
|
||||||
"""Update an operation."""
|
"""Update an operation."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
# Check ID consistency.
|
# Check ID consistency.
|
||||||
if 'id' in data and data['id'] and data['id'] != id:
|
if 'id' in data and data['id'] and data['id'] != id:
|
||||||
|
@ -109,7 +109,7 @@ class ScheduledOperationListResource(Resource):
|
|||||||
def post(self):
|
def post(self):
|
||||||
"""Add a new scheduled operation."""
|
"""Add a new scheduled operation."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
account_id = data['account_id']
|
account_id = data['account_id']
|
||||||
account = Account.query().get(account_id)
|
account = Account.query().get(account_id)
|
||||||
@ -175,7 +175,7 @@ class ScheduledOperationResource(Resource):
|
|||||||
def post(self, id):
|
def post(self, id):
|
||||||
"""Update a scheduled operation."""
|
"""Update a scheduled operation."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
# Check ID consistency.
|
# Check ID consistency.
|
||||||
if 'id' in data and data['id'] and data['id'] != id:
|
if 'id' in data and data['id'] and data['id'] != id:
|
||||||
|
@ -128,7 +128,7 @@ class LoginResource(Resource):
|
|||||||
def post(self):
|
def post(self):
|
||||||
"""Login to retrieve authentication token."""
|
"""Login to retrieve authentication token."""
|
||||||
|
|
||||||
data = ns.apis[0].payload
|
data = self.api.payload
|
||||||
|
|
||||||
user = User.query().filter(
|
user = User.query().filter(
|
||||||
User.email == data['email']
|
User.email == data['email']
|
||||||
|
Loading…
Reference in New Issue
Block a user