diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-11-17 10:27:57 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2015-11-17 10:27:57 +0100 |
commit | 0ba11942bf19941fe09b3c2de33e3f6155edcf34 (patch) | |
tree | 340d94aa2ba1ab6cffa312fafd78faea27524be1 /pyaggr3g470r | |
parent | Updated Python runtime for Heroku. (diff) | |
download | newspipe-0ba11942bf19941fe09b3c2de33e3f6155edcf34.tar.gz newspipe-0ba11942bf19941fe09b3c2de33e3f6155edcf34.tar.bz2 newspipe-0ba11942bf19941fe09b3c2de33e3f6155edcf34.zip |
minor improvements when deleting old articles, this was stupid...
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/views/views.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/pyaggr3g470r/views/views.py b/pyaggr3g470r/views/views.py index cf405fe4..2e5d01fb 100644 --- a/pyaggr3g470r/views/views.py +++ b/pyaggr3g470r/views/views.py @@ -612,12 +612,10 @@ 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( - and_(Article.user_id == g.user.id, - or_(Article.date < weeks_ago, - Article.retrieved_date < weeks_ago))) - for article in articles_to_delete: - db.session.delete(article) + Article.query.filter( + and_(Article.user_id == g.user.id, + or_(Article.date < weeks_ago, + Article.retrieved_date < weeks_ago))).delete() flash(gettext('Articles deleted.'), 'info') db.session.commit() return redirect(redirect_url()) |