From f1d81d86aae050b5c4f060a843bba894c209e072 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 13 Jun 2017 13:07:31 +0200 Subject: [PATCH] Fix configtypes _basic_validation --- qutebrowser/config/configtypes.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/qutebrowser/config/configtypes.py b/qutebrowser/config/configtypes.py index 1969ec946..75d8a1720 100644 --- a/qutebrowser/config/configtypes.py +++ b/qutebrowser/config/configtypes.py @@ -116,22 +116,18 @@ class BaseType: value: The value to check. pytype: If given, a Python type to check the value against. """ - if not value: - if self.none_ok: - return - else: - raise configexc.ValidationError(value, "may not be empty!") - - if isinstance(value, str): - if any(ord(c) < 32 or ord(c) == 0x7f for c in value): - raise configexc.ValidationError(value, "may not contain " - "unprintable chars!") - if pytype is not None and not isinstance(value, pytype): raise configexc.ValidationError( value, "expected a value of type {} but got {}".format( pytype, type(value))) + if isinstance(value, str): + if not value and not self.none_ok: + raise configexc.ValidationError(value, "may not be empty!") + if any(ord(c) < 32 or ord(c) == 0x7f for c in value): + raise configexc.ValidationError(value, "may not contain " + "unprintable chars!") + def _validate_valid_values(self, value): """Validate value against possible values.