aboutsummaryrefslogtreecommitdiff
path: root/src/web/views/article.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2018-10-31 22:18:19 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2018-10-31 22:18:19 +0100
commitf53453069d81989670586ef54130b026dd31a1e1 (patch)
treeac08e0fd27ac0475b5b819f2b33955a9ee4b9a02 /src/web/views/article.py
parentImproved filtering to get only articles from public feed via the public profi... (diff)
downloadnewspipe-f53453069d81989670586ef54130b026dd31a1e1.tar.gz
newspipe-f53453069d81989670586ef54130b026dd31a1e1.tar.bz2
newspipe-f53453069d81989670586ef54130b026dd31a1e1.zip
Improved the import/export functions for data liberation. It is now possible to export all feeds to OPML with ou without enabled and private feeds.
Diffstat (limited to 'src/web/views/article.py')
-rw-r--r--src/web/views/article.py32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/web/views/article.py b/src/web/views/article.py
index 640de8b4..bf39795d 100644
--- a/src/web/views/article.py
+++ b/src/web/views/article.py
@@ -139,30 +139,16 @@ def expire():
@login_required
def export():
"""
- Export to OPML or JSON.
+ Export articles to JSON.
"""
user = UserController(current_user.id).get(id=current_user.id)
- if request.args.get('format') == "JSON":
- # Export to JSON for the export of account.
- try:
- json_result = export_json(user)
- except Exception as e:
- flash(gettext("Error when exporting articles."), 'danger')
- return redirect(redirect_url())
- response = make_response(json_result)
- response.mimetype = 'application/json'
- response.headers["Content-Disposition"] \
- = 'attachment; filename=account.json'
- elif request.args.get('format') == "OPML":
- # Export to the OPML format.
- categories = {cat.id: cat.dump()
- for cat in CategoryController(user.id).read()}
- response = make_response(render_template('opml.xml', user=user,
- categories=categories,
- now=datetime.now()))
- response.headers['Content-Type'] = 'application/xml'
- response.headers['Content-Disposition'] = 'attachment; filename=feeds.opml'
- else:
- flash(gettext('Export format not supported.'), 'warning')
+ try:
+ json_result = export_json(user)
+ except Exception as e:
+ flash(gettext("Error when exporting articles."), 'danger')
return redirect(redirect_url())
+ response = make_response(json_result)
+ response.mimetype = 'application/json'
+ response.headers["Content-Disposition"] \
+ = 'attachment; filename=account.json'
return response
bgstack15