diff options
author | cedricbonhomme <devnull@localhost> | 2011-07-07 18:21:38 +0200 |
---|---|---|
committer | cedricbonhomme <devnull@localhost> | 2011-07-07 18:21:38 +0200 |
commit | 4294c12669e0fa1d578c03dd344ad05a95218cb1 (patch) | |
tree | 91059f4c2b39fad7e7d7cc065c390dd25206c251 | |
parent | Minor bugfix: When using the control script the main process was attached to ... (diff) | |
download | newspipe-4294c12669e0fa1d578c03dd344ad05a95218cb1.tar.gz newspipe-4294c12669e0fa1d578c03dd344ad05a95218cb1.tar.bz2 newspipe-4294c12669e0fa1d578c03dd344ad05a95218cb1.zip |
reinitialize sha1.update() before each hash.
-rwxr-xr-x | feedgetter.py | 8 | ||||
-rwxr-xr-x | utils.py | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/feedgetter.py b/feedgetter.py index c1d01ed8..f60286e7 100755 --- a/feedgetter.py +++ b/feedgetter.py @@ -25,6 +25,8 @@ __date__ = "$Date: 2010/09/02 $" __copyright__ = "Copyright (c) Cedric Bonhomme" __license__ = "GPLv3" +import os.path +import traceback import sqlite3 import threading import feedparser @@ -159,13 +161,15 @@ class FeedGetter(object): ).start() except Exception, e: # SMTP acces denied, to many SMTP connections, etc. - print e + top = traceback.extract_stack()[-1] + print ", ".join([type(e).__name__, os.path.basename(top[0]), str(top[1])]) except sqlite3.IntegrityError: # article already in the data base pass except Exception, e: # Missing information (updated_parsed, ...) - print e + top = traceback.extract_stack()[-1] + print ", ".join([type(e).__name__, os.path.basename(top[0]), str(top[1]), str(traceback.extract_stack()[-2][3])]) if __name__ == "__main__": @@ -400,7 +400,6 @@ def load_feed(): feeds = OrderedDict() if list_of_feeds != []: - sha1_hash = hashlib.sha1() # Case-insensitive sorting tupleList = [(x[0].lower(), x) for x in list_of_feeds] tupleList.sort(key=operator.itemgetter(0)) @@ -410,7 +409,7 @@ def load_feed(): list_of_articles = c.execute(\ "SELECT * FROM articles WHERE feed_link='" + \ feed[2] + "'").fetchall() - + sha1_hash = hashlib.sha1() sha1_hash.update(feed[2].encode('utf-8')) feed_id = sha1_hash.hexdigest() @@ -426,9 +425,10 @@ def load_feed(): if list_of_articles != []: list_of_articles.sort(lambda x,y: compare(y[0], x[0])) if MAX_NB_ARTICLES != -1: - list_of_articles = list_of_articles[:MAX_NB_ARTICLES] + list_of_articles = list_of_articles[:MAX_NB_ARTICLES] # Walk through the list of articles for the current feed. for article in list_of_articles: + sha1_hash = hashlib.sha1() sha1_hash.update(article[2].encode('utf-8')) article_id = sha1_hash.hexdigest() |