From d78d0c0136531093ad66a093d6cc0695967fc043 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Tue, 19 Apr 2016 13:25:02 +0200 Subject: Defined an url prefix for the new API. --- src/web/views/api/v3/article.py | 3 ++- src/web/views/api/v3/common.py | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'src/web/views/api/v3') diff --git a/src/web/views/api/v3/article.py b/src/web/views/api/v3/article.py index da75dc47..cc769597 100644 --- a/src/web/views/api/v3/article.py +++ b/src/web/views/api/v3/article.py @@ -1,9 +1,10 @@ from web import models from bootstrap import application, manager -from web.views.api.v3.common import auth_func, check_auth +from web.views.api.v3.common import url_prefix, auth_func, check_auth blueprint_article = manager.create_api_blueprint(models.Article, + url_prefix=url_prefix, methods=['GET', 'POST', 'PUT', 'DELETE'], preprocessors=dict(GET_SINGLE=[auth_func, check_auth])) application.register_blueprint(blueprint_article) diff --git a/src/web/views/api/v3/common.py b/src/web/views/api/v3/common.py index 8831b8ba..b4e6b62e 100644 --- a/src/web/views/api/v3/common.py +++ b/src/web/views/api/v3/common.py @@ -3,6 +3,9 @@ from flask.ext.restless import ProcessingException from web.controllers import ArticleController +url_prefix = '/api/v3' + + def is_authorized_to_modify(user, obj): return user.id == obj.user_id -- cgit