From 57c1c0edfd5162d816acda10336a2ec068f4430d Mon Sep 17 00:00:00 2001 From: Alessandro DiMarco Date: Thu, 26 Jan 2017 17:57:36 -0500 Subject: [PATCH] Switch views to standard login required --- app/views/building.py | 6 ++---- app/views/turk_hit.py | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/views/building.py b/app/views/building.py index 0ac630d..9c9e425 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 ef54ad2..0451e82 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. -- GitLab