diff options
| author | Georgios Andreadis <info@gandreadis.com> | 2020-06-24 09:13:09 +0200 |
|---|---|---|
| committer | Georgios Andreadis <info@gandreadis.com> | 2020-06-24 09:13:09 +0200 |
| commit | bae760a62fc6a480fbe615dff6a7de03c7fd6d1d (patch) | |
| tree | 06fc47f9922add14a3ac50fcfdfeb3d4fdc00363 /opendc/api/v2/rooms/roomId/endpoint.py | |
| parent | 6fdb3e75dad15523d996e457c216647755b29101 (diff) | |
Add formatter
Diffstat (limited to 'opendc/api/v2/rooms/roomId/endpoint.py')
| -rw-r--r-- | opendc/api/v2/rooms/roomId/endpoint.py | 52 |
1 files changed, 13 insertions, 39 deletions
diff --git a/opendc/api/v2/rooms/roomId/endpoint.py b/opendc/api/v2/rooms/roomId/endpoint.py index 1dfc32cc..a43a82e7 100644 --- a/opendc/api/v2/rooms/roomId/endpoint.py +++ b/opendc/api/v2/rooms/roomId/endpoint.py @@ -9,18 +9,14 @@ def GET(request): # Make sure required parameters are there try: - request.check_required_parameters( - path={ - 'roomId': 'int' - } - ) + request.check_required_parameters(path={'roomId': 'int'}) except exceptions.ParameterError as e: return Response(400, e.message) # Instantiate a Room from the database - room = Room.from_primary_key((request.params_path['roomId'],)) + room = Room.from_primary_key((request.params_path['roomId'], )) # Make sure this Room exists @@ -36,11 +32,7 @@ def GET(request): room.read() - return Response( - 200, - 'Successfully retrieved {}.'.format(room), - room.to_JSON() - ) + return Response(200, 'Successfully retrieved {}.'.format(room), room.to_JSON()) def PUT(request): @@ -49,24 +41,18 @@ def PUT(request): # Make sure required parameters are there try: - request.check_required_parameters( - path={ - 'roomId': 'int' - }, - body={ - 'room': { - 'name': 'string', - 'roomType': 'string' - } - } - ) + request.check_required_parameters(path={'roomId': 'int'}, + body={'room': { + 'name': 'string', + 'roomType': 'string' + }}) except exceptions.ParameterError as e: return Response(400, e.message) # Instantiate a Room from the database - room = Room.from_primary_key((request.params_path['roomId'],)) + room = Room.from_primary_key((request.params_path['roomId'], )) # Make sure this Room exists @@ -90,11 +76,7 @@ def PUT(request): # Return this Room - return Response( - 200, - 'Successfully updated {}.'.format(room), - room.to_JSON() - ) + return Response(200, 'Successfully updated {}.'.format(room), room.to_JSON()) def DELETE(request): @@ -103,18 +85,14 @@ def DELETE(request): # Make sure required parameters are there try: - request.check_required_parameters( - path={ - 'roomId': 'int' - } - ) + request.check_required_parameters(path={'roomId': 'int'}) except exceptions.ParameterError as e: return Response(400, e.message) # Instantiate a Room and make sure it exists - room = Room.from_primary_key((request.params_path['roomId'],)) + room = Room.from_primary_key((request.params_path['roomId'], )) if not room.exists(): return Response(404, '{} not found.'.format(room)) @@ -130,8 +108,4 @@ def DELETE(request): # Return this Room - return Response( - 200, - 'Successfully deleted {}.'.format(room), - room.to_JSON() - ) + return Response(200, 'Successfully deleted {}.'.format(room), room.to_JSON()) |
