aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xfeedgetter.py8
-rwxr-xr-xutils.py6
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__":
diff --git a/utils.py b/utils.py
index 74519161..e145b6b2 100755
--- a/utils.py
+++ b/utils.py
@@ -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()
bgstack15