diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-12 19:10:38 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-12 19:10:38 +0200 |
commit | 882581abe066f16f14b7cc54776bb7985f2b34c6 (patch) | |
tree | 314d2c1420428d2153c33f64d5b3bba631816f58 /pyaggr3g470r/export.py | |
parent | Trying the export to HTML option on Heroku (2). (diff) | |
download | newspipe-882581abe066f16f14b7cc54776bb7985f2b34c6.tar.gz newspipe-882581abe066f16f14b7cc54776bb7985f2b34c6.tar.bz2 newspipe-882581abe066f16f14b7cc54776bb7985f2b34c6.zip |
Trying the export to HTML option on Heroku (3).
Diffstat (limited to 'pyaggr3g470r/export.py')
-rw-r--r-- | pyaggr3g470r/export.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py index da63774e..530c08fd 100644 --- a/pyaggr3g470r/export.py +++ b/pyaggr3g470r/export.py @@ -136,7 +136,7 @@ def export_html(user): """ Export all articles of 'user' in Web pages. """ - webzine_root = conf.PATH + "/pyaggr3g470r/var/export/webzine/" + webzine_root = conf.WEBZINE_ROOT nb_articles = format(len(models.Article.query.filter(models.Article.user_id == user.id).all()), ",d") index = HTML_HEADER("News archive") index += "<h1>List of feeds</h1>\n" @@ -177,8 +177,9 @@ def export_html(user): f.write(a_post.encode("utf-8")) posts += HTML_FOOTER - with open(feed_index, "w") as f: - f.write(posts.encode("utf-8")) + if len(feed.articles.all()) != 0: + with open(feed_index, "w") as f: + f.write(posts.encode("utf-8")) index += "</ul>\n" index += "<p>" + time.strftime("Generated on %d %b %Y at %H:%M.") + "</p>\n" |