From 3516a438fee31a4a7ad04d39950ad8b5649abe66 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Thu, 23 Feb 2017 16:11:32 -0500 Subject: [PATCH 1/2] Switch to rest view --- app/views/building.py | 4 ++-- app/views/turk_hit.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/building.py b/app/views/building.py index dae47f2..a236197 100644 --- a/app/views/building.py +++ b/app/views/building.py @@ -2,11 +2,11 @@ from flask import request from werkzeug.exceptions import MethodNotAllowed from ..controllers.building import BuildingController -from .base import UnprotectedRestView +from .base import RestView from ..permissions.application import app_need -class BuildingView(UnprotectedRestView): +class BuildingView(RestView): """The building view.""" def get_controller(self): """Return an instance of the building controller.""" diff --git a/app/views/turk_hit.py b/app/views/turk_hit.py index b5edaa6..88d660f 100644 --- a/app/views/turk_hit.py +++ b/app/views/turk_hit.py @@ -2,13 +2,13 @@ from werkzeug.exceptions import (BadRequest, NotFound, MethodNotAllowed, BadGateway) from ..controllers.turk_hit import TurkHitController -from .base import UnprotectedRestView +from .base import RestView from ..permissions.application import app_need from boto.mturk.connection import MTurkRequestError from flask import request -class TurkHitView(UnprotectedRestView): +class TurkHitView(RestView): """The turk hit view.""" def get_controller(self): """Return an instance of the turk hit controller.""" -- GitLab From eda944b0db7e747050090eaf05c9b357765c0d61 Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Thu, 23 Feb 2017 16:23:30 -0500 Subject: [PATCH 2/2] Remove app need from RestView routes --- app/views/building.py | 3 --- app/views/turk_hit.py | 8 ++------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/app/views/building.py b/app/views/building.py index a236197..8e56151 100644 --- a/app/views/building.py +++ b/app/views/building.py @@ -3,7 +3,6 @@ from flask import request from werkzeug.exceptions import MethodNotAllowed from ..controllers.building import BuildingController from .base import RestView -from ..permissions.application import app_need class BuildingView(RestView): @@ -12,7 +11,6 @@ class BuildingView(RestView): """Return an instance of the building controller.""" return BuildingController() - @app_need def index(self): """/ GET - Retrieve a list of resources.""" # TODO: Add data key back to self.json @@ -23,7 +21,6 @@ class BuildingView(RestView): ] }) - @app_need def get(self, id_): """/{id} GET - Retrieve a resource by id.""" # TODO: Add data key back in self.json diff --git a/app/views/turk_hit.py b/app/views/turk_hit.py index 88d660f..2aea9b2 100644 --- a/app/views/turk_hit.py +++ b/app/views/turk_hit.py @@ -1,11 +1,10 @@ """Views for working with turk_hit.""" +from flask import request from werkzeug.exceptions import (BadRequest, NotFound, MethodNotAllowed, BadGateway) +from boto.mturk.connection import MTurkRequestError from ..controllers.turk_hit import TurkHitController from .base import RestView -from ..permissions.application import app_need -from boto.mturk.connection import MTurkRequestError -from flask import request class TurkHitView(RestView): @@ -17,7 +16,6 @@ class TurkHitView(RestView): def index(self): raise MethodNotAllowed() - @app_need def get(self, id_): """/{id} GET - Retrieve the hit status by building id.""" try: @@ -30,7 +28,6 @@ class TurkHitView(RestView): raise BadGateway(error.error_code) return self.json(response) - @app_need def post(self): """/ POST - Create a hit given an id in the POST body""" try: @@ -42,7 +39,6 @@ class TurkHitView(RestView): return self.json(response, 201) - @app_need def put(self, id_): """ / PUT - Approve or decline a hit given a building_id. -- GitLab