aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/api/v3/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/web/views/api/v3/common.py')
-rw-r--r--src/web/views/api/v3/common.py44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/web/views/api/v3/common.py b/src/web/views/api/v3/common.py
index 51e4e6be..05ce7057 100644
--- a/src/web/views/api/v3/common.py
+++ b/src/web/views/api/v3/common.py
@@ -1,3 +1,31 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# JARR - A Web based news aggregator.
+# Copyright (C) 2010-2016 Cédric Bonhomme - https://www.cedricbonhomme.org
+#
+# For more information : http://github.com/JARR/JARR
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>
+
+__author__ = "Cedric Bonhomme"
+__version__ = "$Revision: 0.1 $"
+__date__ = "$Date: 2016/04/29 $"
+__revision__ = "$Date: 2016/04/29 $"
+__copyright__ = "Copyright (c) Cedric Bonhomme"
+__license__ = "GPLv3"
+
from flask import request
from flask.ext.login import current_user
from flask.ext.restless import ProcessingException
@@ -61,5 +89,21 @@ class AbstractProcessor():
"""
pass
+ def put_many_preprocessor(search_params=None, data=None, **kw):
+ """Accepts two arguments: `search_params`, which is a dictionary
+ containing the search parameters for the request, and `data`, which
+ is a dictionary representing the fields to change on the matching
+ instances and the values to which they will be set.
+ """
+ filt = dict(name="user_id",
+ op="eq",
+ val=current_user.id)
+
+ # Check if there are any filters there already.
+ if "filters" not in search_params:
+ search_params["filters"] = []
+
+ search_params["filters"].append(filt)
+
def delete_preprocessor(self, instance_id=None, **kw):
pass
bgstack15