aboutsummaryrefslogtreecommitdiff
path: root/src/web/views
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-24 23:06:32 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2017-05-24 23:06:32 +0200
commitd15d428a59df925c9cb25ea869d7007132cb4416 (patch)
treed3abf3896f0253dd67b009cf9def659224b7cad4 /src/web/views
parentImport bookmarks from pinboard.in (diff)
downloadnewspipe-d15d428a59df925c9cb25ea869d7007132cb4416.tar.gz
newspipe-d15d428a59df925c9cb25ea869d7007132cb4416.tar.bz2
newspipe-d15d428a59df925c9cb25ea869d7007132cb4416.zip
Import from pinboard is now faster. Bookmarks are sorted by time.
Diffstat (limited to 'src/web/views')
-rw-r--r--src/web/views/bookmark.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/web/views/bookmark.py b/src/web/views/bookmark.py
index 87142024..d8f0ee6f 100644
--- a/src/web/views/bookmark.py
+++ b/src/web/views/bookmark.py
@@ -5,6 +5,7 @@ from flask import Blueprint, render_template, flash, \
redirect, request, url_for
from flask_babel import gettext
from flask_login import login_required, current_user
+from sqlalchemy import desc
import conf
from lib.utils import redirect_url
@@ -22,9 +23,12 @@ bookmark_bp = Blueprint('bookmark', __name__, url_prefix='/bookmark')
@login_required
def list():
"Lists the bookmarks."
+ head_titles = ["Bookmarks"]
bookmark_contr = BookmarkController(current_user.id)
return render_template('bookmarks.html',
- bookmarks=BookmarkController(current_user.id).read().order_by('time'))
+ head_titles=head_titles,
+ bookmarks=BookmarkController(current_user.id) \
+ .read().order_by(desc('time')))
@bookmark_bp.route('/create', methods=['GET'])
@@ -135,7 +139,7 @@ def import_pinboard():
nb_bookmarks = import_pinboard_json(current_user, bookmarks.read())
flash(gettext("%(nb_bookmarks)s bookmarks successfully imported.",
nb_bookmarks=nb_bookmarks), 'success')
- except:
+ except Exception as e:
flash(gettext('Error when importing bookmarks.'), 'error')
-
+
return redirect(redirect_url())
bgstack15