aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2010-04-29 09:08:26 +0200
committercedricbonhomme <devnull@localhost>2010-04-29 09:08:26 +0200
commit3855b64d4d582273b33f16d4c35b4faf9238cfff (patch)
tree9b9ae9748b18b0bfe8de4193c280917d135fdfa4 /pyAggr3g470r.py
parentNew regular expression to remove special characters (for instance &#8217;). (diff)
downloadnewspipe-3855b64d4d582273b33f16d4c35b4faf9238cfff.tar.gz
newspipe-3855b64d4d582273b33f16d4c35b4faf9238cfff.tar.bz2
newspipe-3855b64d4d582273b33f16d4c35b4faf9238cfff.zip
Minor bug fix and some improvements.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 42536371..42a8c49e 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -213,8 +213,7 @@ class Root:
html += "<hr />\n"
if self.articles:
self.top_words = utils.top_words(self.articles, n=50, size=int(word_size))
- if "pylab" not in utils.IMPORT_ERROR:
- utils.create_histogram(self.top_words[:10])
+ utils.create_histogram(self.top_words[:10])
html += "<h1>Statistics</h1>\n<br />\n"
if "oice" not in utils.IMPORT_ERROR:
nb_french = 0
@@ -602,9 +601,9 @@ class Root:
Mark one (or more) article(s) as read by setting the value of the field
'article_readed' of the SQLite database to 1.
"""
- LOCKER.acquire()
param, _, identifiant = target.partition(':')
try:
+ LOCKER.acquire()
conn = sqlite3.connect(utils.sqlite_base, isolation_level = None)
c = conn.cursor()
# Mark all articles as read.
@@ -622,14 +621,13 @@ class Root:
c.close()
except Exception:
self.error_page("Impossible to mark this article as read (database error).")
-
- #threading.Thread(None, self.update, None, ()).start()
+ finally:
+ LOCKER.release()
if param == "All" or param == "Feed_FromMainPage":
return self.index()
elif param == "Feed":
return self.all_articles(identifiant)
- LOCKER.release()
mark_as_read.exposed = True
@@ -737,6 +735,8 @@ class Root:
(rss_feed_id, article[0].encode('utf-8'), article[2].encode('utf-8'), \
self.feeds[rss_feed_id][5].encode('utf-8'), \
self.feeds[rss_feed_id][3].encode('utf-8'))
+ if article == self.articles[rss_feed_id][-1]:
+ html += "<br />"
html += "<hr />\n"
html += htmlfooter
return html
@@ -754,8 +754,7 @@ class Root:
self.nb_articles = sum([feed[0] for feed in self.feeds.values()])
if self.articles != {}:
self.top_words = utils.top_words(self.articles, 10, size=6)
- if "pylab" not in utils.IMPORT_ERROR:
- utils.create_histogram(self.top_words)
+ utils.create_histogram(self.top_words)
print "Base (%s) loaded" % utils.sqlite_base
else:
print "Base (%s) empty!" % utils.sqlite_base
bgstack15