diff options
author | cedricbonhomme <devnull@localhost> | 2010-01-30 13:33:18 +0100 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2010-01-30 13:33:18 +0100 |
commit | f57d9256d642a8f10d710451b3c607e913118c28 (patch) | |
tree | d17429771b3dcbcaded7f3724dd5968cc3e25c5e /pyAggr3g470r.py | |
parent | Downloading of informations feeds and the update of base are asynchronous. Us... (diff) | |
download | newspipe-f57d9256d642a8f10d710451b3c607e913118c28.tar.gz newspipe-f57d9256d642a8f10d710451b3c607e913118c28.tar.bz2 newspipe-f57d9256d642a8f10d710451b3c607e913118c28.zip |
All date are parsed into the standard Python datetime format.
Diffstat (limited to 'pyAggr3g470r.py')
-rw-r--r-- | pyAggr3g470r.py | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py index 839bdc90..bc6f6340 100644 --- a/pyAggr3g470r.py +++ b/pyAggr3g470r.py @@ -54,8 +54,9 @@ class Root: '">' + dic[rss_feed][0][1].encode('utf-8') + "</a></h2>" for article in dic[rss_feed]: - html += '<a href="' + article[3].encode('utf-8') + \ - '">' + article[2].encode('utf-8') + "</a><br />" + html += article[0].encode('utf-8') + " - " + \ + '<a href="' + article[3].encode('utf-8') + \ + '">' + article[2].encode('utf-8') + "</a><br />" html += htmlfooter return html @@ -67,19 +68,25 @@ class Root: def retrieve_feed(self): - conn = sqlite3.connect("./var/feed.db", isolation_level = None) - c = conn.cursor() - list_of_articles = c.execute("SELECT * FROM rss_feed").fetchall() - c.close() - - dic = {} - for article in list_of_articles: - if article[2] not in dic: - dic[article[2]] = [(article[0], article[1], article[3], article[4])] - else: - dic[article[2]].append((article[0], article[1], article[3], article[4])) - - return dic + list_of_articles = None + try: + conn = sqlite3.connect("./var/feed.db", isolation_level = None) + c = conn.cursor() + list_of_articles = c.execute("SELECT * FROM rss_feed").fetchall() + c.close() + except: + pass + + if list_of_articles is not None: + dic = {} + for article in list_of_articles: + if article[2] not in dic: + dic[article[2]] = [(article[0], article[1], article[3], article[4])] + else: + dic[article[2]].append((article[0], article[1], article[3], article[4])) + + return dic + return {} index.exposed = True f.exposed = True |