Remove unnecessary try, rephrase to imperative mood

This commit is contained in:
gammelon 2018-02-20 18:11:50 +01:00
parent 42ac3dcda0
commit 16218a9900
2 changed files with 5 additions and 8 deletions

View File

@ -1448,8 +1448,7 @@ url.incdec_segments:
url.open_base_url:
type: Bool
default: false
desc: Invoking `:open {shortcut}` (without argument), where {shortcut} is a search engine shortcut
will open the base url of the shortcut instead of using the default search engine.
desc: Open base URL of the searchengine if a searchengine shortcut is invoked without parameters.
url.searchengines:
default:

View File

@ -103,12 +103,10 @@ def _get_search_url(txt):
template = config.val.url.searchengines[engine]
url = qurl_from_user_input(template.format(urllib.parse.quote(term)))
if config.val.url.open_base_url:
try:
search_url = urllib.parse.urlparse(config.val.url.searchengines[term])
url = QUrl('{}://{}'.format(search_url.scheme, search_url.netloc))
except KeyError:
pass
if config.val.url.open_base_url and \
term in config.val.url.searchengines.keys():
search_url = urllib.parse.urlparse(config.val.url.searchengines[term])
url = QUrl('{}://{}'.format(search_url.scheme, search_url.netloc))
qtutils.ensure_valid(url)
return url