diff options
author | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-02 11:26:07 +0100 |
---|---|---|
committer | Cédric Bonhomme <kimble.mandel@gmail.com> | 2013-01-02 11:26:07 +0100 |
commit | fdc8d24c941681f344f999cbb8266e275760db1c (patch) | |
tree | 5b73e362f95db2dfee2badc55bfa041ac22399fe | |
parent | Numbers are printed with commas as thousands separators. (diff) | |
download | newspipe-fdc8d24c941681f344f999cbb8266e275760db1c.tar.gz newspipe-fdc8d24c941681f344f999cbb8266e275760db1c.tar.bz2 newspipe-fdc8d24c941681f344f999cbb8266e275760db1c.zip |
Numbers are printed with commas as thousands separators without taking into account the locale of the system.
-rwxr-xr-x | source/pyAggr3g470r.py | 4 | ||||
-rw-r--r-- | source/templates/feed.html | 2 | ||||
-rw-r--r-- | source/templates/index.html | 2 | ||||
-rwxr-xr-x | source/utils.py | 6 |
4 files changed, 7 insertions, 7 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py index 20b0ea20..a3c38ff0 100755 --- a/source/pyAggr3g470r.py +++ b/source/pyAggr3g470r.py @@ -133,8 +133,8 @@ class pyAggr3g470r(object): feeds = self.mongo.get_all_feeds() nb_mail_notifications = self.mongo.nb_mail_notifications() nb_favorites = self.mongo.nb_favorites() - nb_articles = locale.format("%d", self.mongo.nb_articles(), grouping=True) - nb_unread_articles = locale.format("%d", self.mongo.nb_unread_articles(), grouping=True) + nb_articles = format(self.mongo.nb_articles(), ",d") + nb_unread_articles = format(self.mongo.nb_unread_articles(), ",d") tmpl = lookup.get_template("management.html") return tmpl.render(feeds=feeds, nb_mail_notifications=nb_mail_notifications, \ nb_favorites=nb_favorites, nb_articles=nb_articles, \ diff --git a/source/templates/feed.html b/source/templates/feed.html index 01799fb7..8e10393c 100644 --- a/source/templates/feed.html +++ b/source/templates/feed.html @@ -5,7 +5,7 @@ import utils %> <div class="left inner"> <p>The feed <b>${feed['feed_title']}</b> contains <b>${nb_articles_feed}</b> articles. - Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${nb_articles_total}).</p> + Representing ${round((nb_articles_feed / nb_articles_total) * 100, 4)} percent of the total (${format(nb_articles_total, ',d')}).</p> %if articles: <p>${(nb_unread_articles_feed == 0 and ["All articles are read"] or [str(nb_unread_articles_feed) + " unread article" + (nb_unread_articles_feed == 1 and [""] or ["s"])[0]])[0]}.</p> diff --git a/source/templates/index.html b/source/templates/index.html index fea71154..7a09e25c 100644 --- a/source/templates/index.html +++ b/source/templates/index.html @@ -21,7 +21,7 @@ import utils not_read_begin, not_read_end = "", "" html += """<div><a href="/#%s">%s</a> (<a href="/unread/%s" title="Unread article(s)">%s%s%s</a> / %s)</div>\n""" % \ (feed["feed_id"], feed["feed_title"], feed["feed_id"], not_read_begin, \ - mongo.nb_unread_articles(feed["feed_id"]), not_read_end, mongo.nb_articles(feed["feed_id"])) + format(mongo.nb_unread_articles(feed["feed_id"]), ',d'), not_read_end, format(mongo.nb_articles(feed["feed_id"]), ',d')) %> %endfor ${html} diff --git a/source/utils.py b/source/utils.py index fea123b4..9994c006 100755 --- a/source/utils.py +++ b/source/utils.py @@ -134,15 +134,15 @@ def tag_cloud(tags, query="word_count"): if query == "word_count": # tags cloud from the management page return ' '.join([('<font size=%d><a href="/search/?query=%s" title="Count: %s">%s</a></font>\n' % \ - (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), word, count, word)) \ + (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), word, format(count, ',d'), word)) \ for (word, count) in tags]) if query == "year": # tags cloud for the history return ' '.join([('<font size=%d><a href="/history/?query=%s:%s" title="Count: %s">%s</a></font>\n' % \ - (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), query, word, count, word)) \ + (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), query, word, format(count, ',d'), word)) \ for (word, count) in tags]) return ' '.join([('<font size=%d><a href="/history/?query=%s:%s" title="Count: %s">%s</a></font>\n' % \ - (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), query, word, count, calendar.month_name[int(word)])) \ + (min(1 + count * 7 / max([tag[1] for tag in tags]), 7), query, word, format(count, ',d'), calendar.month_name[int(word)])) \ for (word, count) in tags]) def send_mail(mfrom, mto, feed_title, article_title, description): |