diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-01-12 10:42:21 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-01-12 10:42:21 +0100 |
commit | f8924883291289cd68418b3c2dadcc4f5458ff81 (patch) | |
tree | 2d0255d9a52e0c90e192c4d0e5298900367151fa /pyaggr3g470r | |
parent | The term wasn't adequate. (diff) | |
download | newspipe-f8924883291289cd68418b3c2dadcc4f5458ff81.tar.gz newspipe-f8924883291289cd68418b3c2dadcc4f5458ff81.tar.bz2 newspipe-f8924883291289cd68418b3c2dadcc4f5458ff81.zip |
Keep the MongoDB database and Whoosh index synchronized.
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/views.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 34cdcea7..b0977c65 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -200,7 +200,8 @@ def like(article_id=None): @login_required def delete(article_id=None): """ - Delete an article. + Delete an article from the MongoDB and the Whoosh + databases. """ user = models.User.objects(email=g.user.email).first() # delete the article @@ -210,6 +211,11 @@ def delete(article_id=None): feed.articles.remove(article) article.delete() user.save() + try: + fastsearch.delete_article(str(feed.oid), str(article.id)) + except: + # if index is empty + pass flash('Article "' + article.title + '" deleted.', 'success') return redirect(url_for('home')) flash('Impossible to delete the article.', 'danger') |