Coding style fixes
This commit is contained in:
parent
ae7fe2ee33
commit
d9247c15a4
@ -1120,7 +1120,6 @@ class CommandDispatcher:
|
||||
raise cmdexc.CommandError("Quickmark '{}' not found!".format(name))
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window')
|
||||
@cmdutils.argument('toggle', flag='t')
|
||||
def bookmark_add(self, url=None, title=None, toggle=False):
|
||||
"""Save the current page as a bookmark, or a specific url.
|
||||
|
||||
@ -1152,13 +1151,13 @@ class CommandDispatcher:
|
||||
if not title:
|
||||
title = self._current_title()
|
||||
try:
|
||||
if_added = bookmark_manager.add(url, title, toggle)
|
||||
was_added = bookmark_manager.add(url, title, toggle=toggle)
|
||||
except urlmarks.Error as e:
|
||||
raise cmdexc.CommandError(str(e))
|
||||
else:
|
||||
mes = "Bookmarked {}!" if if_added else "Removed bookmark {}!"
|
||||
msg = "Bookmarked {}!" if was_added else "Removed bookmark {}!"
|
||||
message.info(self._win_id,
|
||||
mes.format(url.toDisplayString()))
|
||||
msg.format(url.toDisplayString()))
|
||||
|
||||
@cmdutils.register(instance='command-dispatcher', scope='window',
|
||||
maxsplit=0)
|
||||
|
@ -272,17 +272,18 @@ class BookmarkManager(UrlMarkManager):
|
||||
elif len(parts) == 1:
|
||||
self.marks[parts[0]] = ''
|
||||
|
||||
def add(self, url, title, toggle=False):
|
||||
def add(self, url, title, *, toggle=False):
|
||||
"""Add a new bookmark.
|
||||
|
||||
Return True if the bookmark was added, and False if it was
|
||||
removed (which only happens if toggle is True).
|
||||
|
||||
Args:
|
||||
url: The url to add as bookmark.
|
||||
title: The title for the new bookmark.
|
||||
toggle: remove the bookmark instead of raising an error if it
|
||||
already exists.
|
||||
|
||||
Return:
|
||||
True if the bookmark was added, and False if it was
|
||||
removed (only possible if toggle is True).
|
||||
"""
|
||||
if not url.isValid():
|
||||
errstr = urlutils.get_errstring(url)
|
||||
|
Loading…
Reference in New Issue
Block a user