Remove BaseList type

This commit is contained in:
Marshall Lochbaum 2016-07-27 13:06:15 -04:00
parent b205ad500b
commit 642abac634
2 changed files with 12 additions and 19 deletions

View File

@ -135,7 +135,8 @@ def data(readonly=False):
"Whether to find text on a page case-insensitively."),
('startpage',
SettingValue(typ.BaseList(), 'https://duckduckgo.com'),
SettingValue(typ.List(typ.Url(), none_ok=True),
'https://duckduckgo.com'),
"The default page(s) to open at the start, separated by commas."),
('default-page',
@ -352,7 +353,7 @@ def data(readonly=False):
"(requires restart)"),
('keyhint-blacklist',
SettingValue(typ.BaseList(none_ok=True), ''),
SettingValue(typ.List(typ.String(), none_ok=True), ''),
"Keychains that shouldn't be shown in the keyhint dialog\n\n"
"Globs are supported, so ';*' will blacklist all keychains"
"starting with ';'. Use '*' to disable keyhints"),
@ -845,7 +846,7 @@ def data(readonly=False):
"Whether host blocking is enabled."),
('host-blocking-whitelist',
SettingValue(typ.BaseList(none_ok=True), 'piwik.org'),
SettingValue(typ.List(typ.String(), none_ok=True), 'piwik.org'),
"List of domains that should always be loaded, despite being "
"ad-blocked.\n\n"
"Domains may contain * and ? wildcards and are otherwise "

View File

@ -327,9 +327,15 @@ class List(BaseType):
self.inner_type.validate(val.strip())
class BaseList(List):
class FlagList(List):
"""Base class for a list using BaseType."""
"""Base class for a list setting that contains one or more flags.
Lists with duplicate flags are invalid and each item is checked against
self.valid_values (if not empty).
"""
combinable_values = None
def __init__(self, none_ok=False, valid_values=None):
super().__init__(BaseType(), none_ok)
@ -340,20 +346,6 @@ class BaseList(List):
super().validate(value)
else:
self._basic_validation(value)
class FlagList(BaseList):
"""Base class for a list setting that contains one or more flags.
Lists with duplicate flags are invalid and each item is checked against
self.valid_values (if not empty).
"""
combinable_values = None
def validate(self, value):
super().validate(value)
if not value:
return
vals = super().transform(value)