diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-03-02 08:25:52 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-03-02 08:25:52 +0100 |
commit | b32ca6c0f5968f5e9f59847db5012e3ef7f98631 (patch) | |
tree | 83d6bd430c56ae552acb9577a53f0a2c9fbb7052 /src/web/views/api/category.py | |
parent | minor update to the navbar (diff) | |
download | newspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.tar.gz newspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.tar.bz2 newspipe-b32ca6c0f5968f5e9f59847db5012e3ef7f98631.zip |
Code update. Some problems with CSRF token on Chromium...
Diffstat (limited to 'src/web/views/api/category.py')
-rw-r--r-- | src/web/views/api/category.py | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/web/views/api/category.py b/src/web/views/api/category.py index 7923279a..eecfa785 100644 --- a/src/web/views/api/category.py +++ b/src/web/views/api/category.py @@ -1,4 +1,6 @@ -from flask import g +from conf import API_ROOT +from flask import current_app +from flask.ext.restful import Api from web.controllers.category import CategoryController from web.views.api.common import (PyAggResourceNew, @@ -6,26 +8,20 @@ from web.views.api.common import (PyAggResourceNew, PyAggResourceMulti) -CAT_ATTRS = {'name': {'type': str}, - 'user_id': {'type': int}} - - class CategoryNewAPI(PyAggResourceNew): controller_cls = CategoryController - attrs = CAT_ATTRS class CategoryAPI(PyAggResourceExisting): controller_cls = CategoryController - attrs = CAT_ATTRS class CategoriesAPI(PyAggResourceMulti): controller_cls = CategoryController - attrs = CAT_ATTRS -g.api.add_resource(CategoryNewAPI, '/category', endpoint='category_new.json') -g.api.add_resource(CategoryAPI, '/category/<int:obj_id>', - endpoint='category.json') -g.api.add_resource(CategoriesAPI, '/categories', endpoint='categories.json') +api = Api(current_app, prefix=API_ROOT) +api.add_resource(CategoryNewAPI, '/category', endpoint='category_new.json') +api.add_resource(CategoryAPI, '/category/<int:obj_id>', + endpoint='category.json') +api.add_resource(CategoriesAPI, '/categories', endpoint='categories.json') |