diff options
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r-- | pyaggr3g470r/views.py | 4 |
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') |