diff options
Diffstat (limited to 'src/web/views/article.py')
-rw-r--r-- | src/web/views/article.py | 32 |
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 |