aboutsummaryrefslogtreecommitdiff
path: root/utils.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-12-01 12:56:30 +0100
committercedricbonhomme <devnull@localhost>2010-12-01 12:56:30 +0100
commit1bbf38c165d4db9b537c183602da74b717945211 (patch)
treef402e6214458a5edf515cf4bbf47950e8825f4bb /utils.py
parentImprovement. Better address for the page of unread articles. Removed useless ... (diff)
downloadnewspipe-1bbf38c165d4db9b537c183602da74b717945211.tar.gz
newspipe-1bbf38c165d4db9b537c183602da74b717945211.tar.bz2
newspipe-1bbf38c165d4db9b537c183602da74b717945211.zip
Performance optimization. Load of articles (utils.load_feed() function.)
Diffstat (limited to 'utils.py')
-rwxr-xr-xutils.py19
1 files changed, 4 insertions, 15 deletions
diff --git a/utils.py b/utils.py
index ba4de97b..f95007b6 100755
--- a/utils.py
+++ b/utils.py
@@ -37,12 +37,6 @@ import calendar
import unicodedata
import htmlentitydefs
-try:
- # for high performance on list
- from blist import *
-except:
- pass
-
import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
@@ -375,22 +369,17 @@ def load_feed():
article_id = sha1_hash.hexdigest()
# informations about the current article
- article_list = [article_id, article[0], unescape(article[1]), \
+ article_list = (article_id, article[0], unescape(article[1]), \
article[2], unescape(article[3]), \
- article[4], article[6]]
+ article[4], article[6])
# update the number of favorites articles
nb_favorites = nb_favorites + int(article[6])
# add the informations about the current article
# to the list of articles of the current feed
- if feed_id not in articles:
- try:
- articles[feed_id] = blist([article_list])
- except Exception:
- articles[feed_id] = [article_list]
- else:
- articles[feed_id].append(article_list)
+ articles[feed_id] = articles.get(feed_id, [])
+ articles[feed_id].append(article_list)
# informations about a feed
feeds[feed_id] = (len(articles[feed_id]), \
bgstack15