From bae760a62fc6a480fbe615dff6a7de03c7fd6d1d Mon Sep 17 00:00:00 2001 From: Georgios Andreadis Date: Wed, 24 Jun 2020 09:13:09 +0200 Subject: Add formatter --- .../simulationId/datacenters/endpoint.py | 24 +++++++--------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'opendc/api/v2/simulations/simulationId/datacenters') diff --git a/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py b/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py index e28402e4..88c5fe21 100644 --- a/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py +++ b/opendc/api/v2/simulations/simulationId/datacenters/endpoint.py @@ -10,17 +10,11 @@ def POST(request): # Make sure required parameters are there try: - request.check_required_parameters( - path={ - 'simulationId': 'int' - }, - body={ - 'datacenter': { - 'starred': 'int', - 'simulationId': 'int' - } - } - ) + request.check_required_parameters(path={'simulationId': 'int'}, + body={'datacenter': { + 'starred': 'int', + 'simulationId': 'int' + }}) except exceptions.ParameterError as e: return Response(400, e.message) @@ -32,7 +26,7 @@ def POST(request): # Instantiate a Simulation from the database - simulation = Simulation.from_primary_key((request.params_path['simulationId'],)) + simulation = Simulation.from_primary_key((request.params_path['simulationId'], )) # Make sure this Simulation exists @@ -54,8 +48,4 @@ def POST(request): datacenter.read() - return Response( - 200, - 'Successfully added {}.'.format(datacenter), - datacenter.to_JSON() - ) + return Response(200, 'Successfully added {}.'.format(datacenter), datacenter.to_JSON()) -- cgit v1.2.3