aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-28 23:35:18 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-06-28 23:35:18 +0200
commit363c5a27f5bbad243a68f72ec11604e985aa8cf8 (patch)
tree82b7b5217fdc5b560c0a701f214bb74f3a99c4fc
parentTry to delete an article with a jQuery DELETE call. (diff)
downloadnewspipe-363c5a27f5bbad243a68f72ec11604e985aa8cf8.tar.gz
newspipe-363c5a27f5bbad243a68f72ec11604e985aa8cf8.tar.bz2
newspipe-363c5a27f5bbad243a68f72ec11604e985aa8cf8.zip
Delete article from the Whoosh indew when article has been deleted via the REST API.
-rw-r--r--pyaggr3g470r/rest.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pyaggr3g470r/rest.py b/pyaggr3g470r/rest.py
index 34530b02..8de9608e 100644
--- a/pyaggr3g470r/rest.py
+++ b/pyaggr3g470r/rest.py
@@ -33,6 +33,8 @@ from flask import g, Response, request, session, jsonify
from flask.ext.restful import Resource, reqparse
#from flask.ext.restful.inputs import boolean
+if not conf.ON_HEROKU:
+ import search as fastsearch
from pyaggr3g470r import api, db
from pyaggr3g470r.models import User, Article, Feed
@@ -195,6 +197,12 @@ class ArticleAPI(Resource):
if None is not args.get('readed', None):
article.readed = args['readed']
db.session.commit()
+
+ try:
+ fastsearch.delete_article(g.user.id, article.feed_id, article.id)
+ except:
+ pass
+
return {"message":"ok"}
else:
response = jsonify({'code': 404, 'message': 'Article not found'})
bgstack15