← Back to team overview

checkbox-dev team mailing list archive

[PATCH 07/11] plainbox:secure:config: don't validate default values

 

Each Variable instance used to validate the default value but that
validation was inconsistent, it would be silently skipped if the default
value was Unset (which is the implicit default value).

After the generalization of validators and the introduction
of @understands_Unset we have way too many false positives that use
the NotUnsetValidator together with an Unset default to express
the requirement that some variable is defined.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@xxxxxxxxxxxxx>
---
 plainbox/plainbox/impl/secure/config.py | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/plainbox/plainbox/impl/secure/config.py b/plainbox/plainbox/impl/secure/config.py
index c4dbd69..1b4d1f2 100644
--- a/plainbox/plainbox/impl/secure/config.py
+++ b/plainbox/plainbox/impl/secure/config.py
@@ -143,21 +143,9 @@ class Variable(INameTracking):
         self._default = default
         self._validator_list = validator_list
         self._help_text = help_text
-        self._validate_default_value()
         # Workaround for Sphinx breaking if __doc__ is a property
         self.__doc__ = self.help_text or self.__class__.__doc__
 
-    def _validate_default_value(self):
-        """
-        Validate the default value, unless it is Unset
-        """
-        if self.default is Unset:
-            return
-        for validator in self.validator_list:
-            message = validator(self, self.default)
-            if message is not None:
-                raise ValidationError(self, self.default, message)
-
     def validate(self, value):
         """
         Check if the supplied value is valid for this variable.
-- 
1.9.0



References