Exemplo n.º 1
0
 def validate(self, response):
   validated_value = Var.validate(self, response)
   if not self.constraint(validated_value):
     raise ValidateError('Response "%s" did not match constraint.' % response)
   return validated_value
Exemplo n.º 2
0
 def __init__(self, name, *, constraint, **kwargs):
   Var.__init__(self, name, **kwargs)
   self.constraint = constraint