Use self.api i resources.

This commit is contained in:
Alexis Lahouze 2017-05-13 11:17:12 +02:00
parent 3a980262a0
commit 0cda88693f
4 changed files with 7 additions and 7 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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']