diff options
-rw-r--r-- | conf.py | 2 | ||||
-rw-r--r-- | pyaggr3g470r/export.py | 6 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 1 |
3 files changed, 4 insertions, 5 deletions
@@ -45,7 +45,7 @@ if not ON_HEROKU: basedir = os.path.abspath(os.path.dirname(__file__)) PATH = os.path.abspath(".") - WEBZINE_ROOT = PATH + "/pyaggr3g470r/var/export/webzine/" + WEBZINE_ROOT = PATH + "/pyaggr3g470r/var/export/" else: HTTP_PROXY = "" 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: |