##// END OF EJS Templates
early validation hook
Sylvain Corlay -
Show More
@@ -447,6 +447,8 b' class TraitType(object):'
447 def _validate(self, obj, value):
447 def _validate(self, obj, value):
448 if value is None and self.allow_none:
448 if value is None and self.allow_none:
449 return value
449 return value
450 if 'validate' in self._metadata:
451 return self._metadata['validate'](obj, value, self)
450 if hasattr(self, 'validate'):
452 if hasattr(self, 'validate'):
451 return self.validate(obj, value)
453 return self.validate(obj, value)
452 elif hasattr(self, 'is_valid_for'):
454 elif hasattr(self, 'is_valid_for'):
@@ -1054,7 +1056,8 b' class Union(TraitType):'
1054 """Construct a Union trait.
1056 """Construct a Union trait.
1055
1057
1056 This trait allows values that are allowed by at least one of the
1058 This trait allows values that are allowed by at least one of the
1057 specified trait types.
1059 specified trait types. A Union traitlet cannot have metadata on
1060 its own, besides the metadata of the listed types.
1058
1061
1059 Parameters
1062 Parameters
1060 ----------
1063 ----------
General Comments 0
You need to be logged in to leave comments. Login now