From eed13467f3c44a9093fea53c25aae3612e949edc Mon Sep 17 00:00:00 2001 From: haxwithaxe Date: Thu, 17 Mar 2016 20:38:05 -0400 Subject: [PATCH] allow {0} in search engine specification strings to allow multiple instances of the search term in the url --- qutebrowser/config/configtypes.py | 2 +- tests/unit/config/test_configtypes.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index d79e35df1..066fb70c6 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -1196,7 +1196,7 @@ class SearchEngineUrl(BaseType): self._basic_validation(value) if not value: return - elif '{}' not in value: + elif not ('{}' in value or '{0}' in value): raise configexc.ValidationError(value, "must contain \"{}\"") try: value.format("") diff --git a/tests/unit/config/test_configtypes.py b/tests/unit/config/test_configtypes.py index b555ad544..d9a8d9a54 100644 --- a/tests/unit/config/test_configtypes.py +++ b/tests/unit/config/test_configtypes.py @@ -1726,6 +1726,8 @@ class TestSearchEngineUrl: @pytest.mark.parametrize('val', [ 'http://example.com/?q={}', + 'http://example.com/?q={0}', + 'http://example.com/?q={0}&a={0}', '', # empty value with none_ok ]) def test_validate_valid(self, klass, val):