diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-12 19:18:20 +0200 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2014-04-12 19:18:20 +0200 |
commit | 70d5bf5170ff47cee66e4c59e5ee588193543787 (patch) | |
tree | 5c3721beb97f7999d4669d50c0eefead51a99dbb /pyaggr3g470r | |
parent | Trying the export to HTML option on Heroku (3). (diff) | |
download | newspipe-70d5bf5170ff47cee66e4c59e5ee588193543787.tar.gz newspipe-70d5bf5170ff47cee66e4c59e5ee588193543787.tar.bz2 newspipe-70d5bf5170ff47cee66e4c59e5ee588193543787.zip |
Trying the export to HTML option on Heroku (4).
Diffstat (limited to 'pyaggr3g470r')
-rw-r--r-- | pyaggr3g470r/export.py | 6 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/pyaggr3g470r/export.py b/pyaggr3g470r/export.py index 530c08fd..37a55ffe 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.WEBZINE_ROOT + webzine_root = conf.WEBZINE_ROOT + "webzine/" 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" @@ -190,10 +190,10 @@ def export_html(user): f.write(CSS.encode("utf-8")) archive_file_name = datetime.now().strftime('%Y-%m-%d') + '.tar.gz' - with tarfile.open(conf.PATH + "/pyaggr3g470r/var/export/" + archive_file_name, "w:gz") as tar: + with tarfile.open(conf.WEBZINE_ROOT + archive_file_name, "w:gz") as tar: tar.add(webzine_root, arcname=os.path.basename(webzine_root)) shutil.rmtree(webzine_root) - with open(conf.PATH + "/pyaggr3g470r/var/export/" + archive_file_name, 'r') as export_file: + with open(conf.WEBZINE_ROOT + archive_file_name, 'r') as export_file: return export_file.read(), archive_file_name
\ No newline at end of file diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index 9ce597e6..a38dffcd 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -394,7 +394,6 @@ def export_articles(): Export all articles. """ user = User.query.filter(User.id == g.user.id).first() - archive_file, archive_file_name = export.export_html(user) try: archive_file, archive_file_name = export.export_html(user) except: |