aboutsummaryrefslogtreecommitdiff
path: root/manager.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-07-06 15:26:29 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-07-06 15:26:29 +0200
commita867c1243c80843f3736ee260b92d5b13ec510ec (patch)
tree18f4d724abb04d9a14ad7dd5c0b1aca8eb98b3ca /manager.py
parentMerged in jaesivsm/pyaggr3g470r (pull request #16) (diff)
downloadnewspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.tar.gz
newspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.tar.bz2
newspipe-a867c1243c80843f3736ee260b92d5b13ec510ec.zip
Minor fixes from a quick review. Need to test deeper.
Diffstat (limited to 'manager.py')
-rwxr-xr-xmanager.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/manager.py b/manager.py
index a4743895..1c038dd6 100755
--- a/manager.py
+++ b/manager.py
@@ -41,28 +41,30 @@ def fetch_asyncio(user_id, feed_id):
with application.app_context():
populate_g()
+ from flask import g
from pyaggr3g470r.models import User
from pyaggr3g470r import crawler
- users, feed_id = [], None
- try:
- users = User.query.filter(User.id == int(user_id)).all()
- except:
- users = User.query.all()
- finally:
- if users == []:
+ users, feed_id = [], None
+ try:
+ users = User.query.filter(User.id == int(user_id)).all()
+ except:
users = User.query.all()
+ finally:
+ if users == []:
+ users = User.query.all()
- try:
- feed_id = int(feed_id)
- except:
- feed_id = None
+ try:
+ feed_id = int(feed_id)
+ except:
+ feed_id = None
- loop = asyncio.get_event_loop()
- for user in users:
- if user.activation_key == "":
- print("Fetching articles for " + user.nickname)
- feed_getter = crawler.retrieve_feed(loop, user, feed_id)
- loop.close()
+ loop = asyncio.get_event_loop()
+ for user in users:
+ if user.activation_key == "":
+ print("Fetching articles for " + user.nickname)
+ g.user = user
+ feed_getter = crawler.retrieve_feed(loop, g.user, feed_id)
+ loop.close()
if __name__ == '__main__':
manager.run()
bgstack15