From 363c5a27f5bbad243a68f72ec11604e985aa8cf8 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Sat, 28 Jun 2014 23:35:18 +0200 Subject: Delete article from the Whoosh indew when article has been deleted via the REST API. --- pyaggr3g470r/rest.py | 8 ++++++++ 1 file changed, 8 insertions(+) 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'}) -- cgit