diff options
author | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2013-12-08 14:16:25 +0100 |
---|---|---|
committer | Cédric Bonhomme <cedric@cedricbonhomme.org> | 2013-12-08 14:16:25 +0100 |
commit | f7660befccccb25475e19963926b6200fcbb500b (patch) | |
tree | 3711a0523cadbe735bed2cb77d682d41aa9c41e1 /pyaggr3g470r/views.py | |
parent | Updated /management page template. (diff) | |
download | newspipe-f7660befccccb25475e19963926b6200fcbb500b.tar.gz newspipe-f7660befccccb25475e19963926b6200fcbb500b.tar.bz2 newspipe-f7660befccccb25475e19963926b6200fcbb500b.zip |
The name of the archive is composed of the current date.
Diffstat (limited to 'pyaggr3g470r/views.py')
-rw-r--r-- | pyaggr3g470r/views.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index a458c3eb..c30c9983 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -264,13 +264,14 @@ def export_articles(): Export all articles. """ user = models.User.objects(email=g.user.email).first() - export.export_html(user.feeds) - with open(conf.PATH + '/pyaggr3g470r/var/export.tar.gz', 'r') as export_file: - response = make_response(export_file.read()) - response.headers['Content-Type'] = 'application/x-compressed' - response.headers['Content-Disposition'] = 'attachment; filename=export.tar.gz' - return response - return redirect(url_for('management')) + try: + archive_file, archive_file_name = export.export_html(user.feeds) + except: + return redirect(url_for('management')) + response = make_response(archive_file) + response.headers['Content-Type'] = 'application/x-compressed' + response.headers['Content-Disposition'] = 'attachment; filename='+archive_file_name + return response @app.route('/search/', methods=['GET']) @login_required |