aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api/category.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 00:00:37 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2016-04-07 00:00:37 +0200
commit181ee8dced7cccc687136c6f35faf2bff1d22d23 (patch)
tree7a2aea7553433957be0455694a7b39e91668dd42 /src/web/views/api/category.py
parentcommit the session after deleting old articles. (diff)
parentFixed merge conflicts. (diff)
downloadnewspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.tar.gz
newspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.tar.bz2
newspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.zip
Fixed merge conflicts.
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