aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api/category.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-03-02 08:25:52 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-03-02 08:25:52 +0100
commitb32ca6c0f5968f5e9f59847db5012e3ef7f98631 (patch)
tree83d6bd430c56ae552acb9577a53f0a2c9fbb7052 /src/web/views/api/category.py
parentminor update to the navbar (diff)
downloadnewspipe-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.py20
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')
bgstack15