aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/export.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 18:43:07 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-04-12 18:43:07 +0200
commit6806497c0948775a0da7cc06e49ed90fe7484d80 (patch)
tree57b454025460a8ca935869f77d7b9731ef7ac565 /pyaggr3g470r/export.py
parentRemoved option to disable a user. (diff)
downloadnewspipe-6806497c0948775a0da7cc06e49ed90fe7484d80.tar.gz
newspipe-6806497c0948775a0da7cc06e49ed90fe7484d80.tar.bz2
newspipe-6806497c0948775a0da7cc06e49ed90fe7484d80.zip
Export of all articles in HTML pages is now working again (but not yet on Heroku).
Diffstat (limited to 'pyaggr3g470r/export.py')
-rw-r--r--pyaggr3g470r/export.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py
index 3432e0f3..da63774e 100644
--- a/pyaggr3g470r/export.py
+++ b/pyaggr3g470r/export.py
@@ -132,29 +132,29 @@ img {
margin:1.00em 1.00em;
}"""
-def export_html(feeds):
+def export_html(user):
"""
- Export the articles given in parameter in a simple Webzine.
+ Export all articles of 'user' in Web pages.
"""
webzine_root = conf.PATH + "/pyaggr3g470r/var/export/webzine/"
- nb_articles = format(len(models.Article.objects()), ",d")
+ 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"
index += """<p>%s articles.</p>\n<ul>\n""" % (nb_articles,)
- for feed in feeds:
+ for feed in user.feeds:
# creates a folder for each stream
- feed_folder = webzine_root + str(feed.oid)
+ feed_folder = webzine_root + str(feed.id)
try:
os.makedirs(feed_folder)
except OSError:
# directories already exists (not a problem)
pass
- index += """ <li><a href="%s">%s</a></li>\n""" % (feed.oid, feed.title)
+ index += """ <li><a href="%s">%s</a></li>\n""" % (feed.id, feed.title)
posts = HTML_HEADER(feed.title, "../style.css")
posts += """<h1>Articles of the feed <a href="%s">%s</a></h1>\n""" % (feed.site_link, feed.title)
- posts += """<p>%s articles.</p>\n""" % (format(len(feed.articles), ",d"),)
+ posts += """<p>%s articles.</p>\n""" % (format(len(feed.articles.all()), ",d"),)
for article in feed.articles:
bgstack15