diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-07 00:00:37 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2016-04-07 00:00:37 +0200 |
commit | 181ee8dced7cccc687136c6f35faf2bff1d22d23 (patch) | |
tree | 7a2aea7553433957be0455694a7b39e91668dd42 /src/web/controllers/feed.py | |
parent | commit the session after deleting old articles. (diff) | |
parent | Fixed merge conflicts. (diff) | |
download | newspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.tar.gz newspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.tar.bz2 newspipe-181ee8dced7cccc687136c6f35faf2bff1d22d23.zip |
Fixed merge conflicts.
Diffstat (limited to 'src/web/controllers/feed.py')
-rw-r--r-- | src/web/controllers/feed.py | 32 |
1 files changed, 7 insertions, 25 deletions
diff --git a/src/web/controllers/feed.py b/src/web/controllers/feed.py index 78caf2e1..a3f5cae7 100644 --- a/src/web/controllers/feed.py +++ b/src/web/controllers/feed.py @@ -1,24 +1,3 @@ -#! /usr/bin/env python -# -*- coding: utf-8 -*- - -# jarr - A Web based news aggregator. -# Copyright (C) 2010-2016 Cédric Bonhomme - https://www.cedricbonhomme.org -# -# For more information : https://github.com/JARR-aggregator/JARR/ -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. - import logging import itertools from datetime import datetime, timedelta @@ -26,7 +5,7 @@ from datetime import datetime, timedelta import conf from .abstract import AbstractController from .icon import IconController -from web.models import Feed +from web.models import User, Feed from web.lib.utils import clear_string logger = logging.getLogger(__name__) @@ -43,11 +22,12 @@ class FeedController(AbstractController): return [feed for feed in self.read( error_count__lt=max_error, enabled=True, last_retrieved__lt=max_last) + .join(User).filter(User.is_active == True) .order_by('last_retrieved') .limit(limit)] - def list_fetchable(self, max_error=DEFAULT_MAX_ERROR, limit=DEFAULT_LIMIT, - refresh_rate=DEFAULT_REFRESH_RATE): + def list_fetchable(self, max_error=DEFAULT_MAX_ERROR, + limit=DEFAULT_LIMIT, refresh_rate=DEFAULT_REFRESH_RATE): now = datetime.now() max_last = now - timedelta(minutes=refresh_rate) feeds = self.list_late(max_last, max_error, limit) @@ -104,7 +84,9 @@ class FeedController(AbstractController): def update(self, filters, attrs): from .article import ArticleController self._ensure_icon(attrs) - if 'category_id' in attrs: + if 'category_id' in attrs and attrs['category_id'] == 0: + del attrs['category_id'] + elif 'category_id' in attrs: art_contr = ArticleController(self.user_id) for feed in self.read(**filters): art_contr.update({'feed_id': feed.id}, |