diff --git a/app/views/building.py b/app/views/building.py index 0ac630d267ce367723cd8ccef4f51e86c11f331e..9c9e42582e3d5d0af3f65c5c27c251ee9f6589da 100644 --- a/app/views/building.py +++ b/app/views/building.py @@ -1,23 +1,21 @@ """Views for working with buildings.""" from werkzeug.exceptions import MethodNotAllowed from ..controllers.building import BuildingController -from .base import UnprotectedRestView +from .base import RestView from ..permissions.application import app_need from flask import request -class BuildingView(UnprotectedRestView): +class BuildingView(RestView): """The building view.""" def get_controller(self): """Return an instance of the building controller.""" return BuildingController() - @app_need def index(self): """/ GET - Retrieve a list of resources.""" return self.json(self.get_controller().index(request.args)) - @app_need def get(self, id_): """/{id} GET - Retrieve a resource by id.""" return self.json(self.get_controller().get(id_, None)) diff --git a/app/views/turk_hit.py b/app/views/turk_hit.py index ef54ad2b6b50affcf81fa4ec36319b875027f8d4..0451e82d42508670662a5cf3641bdb3639968686 100644 --- a/app/views/turk_hit.py +++ b/app/views/turk_hit.py @@ -1,13 +1,13 @@ """Views for working with turk_hit.""" 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.""" @@ -16,7 +16,6 @@ class TurkHitView(UnprotectedRestView): def index(self): raise MethodNotAllowed() - @app_need def get(self, id_): """/{id} GET - Retrieve the hit status by building id.""" try: @@ -29,7 +28,6 @@ class TurkHitView(UnprotectedRestView): 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: @@ -41,7 +39,6 @@ class TurkHitView(UnprotectedRestView): return self.json(response, 201) - @app_need def put(self, id_): """ / PUT - Approve or decline a hit given a building_id.