aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-08-20 17:23:23 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-08-20 17:23:23 +0200
commit62106a31f8a14710c114b76aebd79d6ad2345fda (patch)
tree317fbf9d00d6c80e83f886baa05a9ae950f96573
parentConfirmation of deletion. (diff)
downloadnewspipe-62106a31f8a14710c114b76aebd79d6ad2345fda.tar.gz
newspipe-62106a31f8a14710c114b76aebd79d6ad2345fda.tar.bz2
newspipe-62106a31f8a14710c114b76aebd79d6ad2345fda.zip
Finally delete article older and retrieved before 10 weeks.
-rw-r--r--pyaggr3g470r/views.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py
index 78aa174e..26a483c1 100644
--- a/pyaggr3g470r/views.py
+++ b/pyaggr3g470r/views.py
@@ -36,7 +36,7 @@ from flask.ext.principal import Principal, Identity, AnonymousIdentity, \
identity_changed, identity_loaded, Permission,\
RoleNeed, UserNeed
from flask.ext.babel import gettext
-from sqlalchemy import desc, func
+from sqlalchemy import desc, func, or_
from sqlalchemy.exc import IntegrityError
from werkzeug import generate_password_hash
@@ -750,7 +750,7 @@ def expire_articles():
"""
current_time = datetime.datetime.utcnow()
weeks_ago = current_time - datetime.timedelta(weeks=int(request.args.get('weeks', 10)))
- articles_to_delete = Article.query.filter(User.email == g.user.email, Article.date < weeks_ago)
+ articles_to_delete = Article.query.filter(User.email == g.user.email, or_(Article.date < weeks_ago, Article.retrieved_date < weeks_ago))
for article in articles_to_delete:
db.session.delete(article)
flash(gettext('Articles deleted.'), 'info')
bgstack15