Пример #1
0
 def validate(self, response):
   validated_value = Var.validate(self, response)
   if not self.constraint(validated_value):
     constraints = ("\n=====Constraints:\nFor application name: should be lowercase.\n"
                    "For class name: its lowercase version should match the app name, not "
                    "counting underscores (that is, they can be 'foo' and 'F_O_o')")
     raise ValidateError('Response "%s" did not match constraint. %s' % (response,
                                                                         constraints))
   return validated_value
Пример #2
0
 def validate(self, response):
     validated_value = Var.validate(self, response)
     if not self.constraint(validated_value):
         constraints = (
             "\n=====Constraints:\nFor application name: should be lowercase.\n"
             "For class name: its lowercase version should match the app name, not "
             "counting underscores (that is, they can be 'foo' and 'F_O_o')"
         )
         raise ValidateError('Response "%s" did not match constraint. %s' %
                             (response, constraints))
     return validated_value
Пример #3
0
 def __init__(self, name, *, constraint, **kwargs):
     Var.__init__(self, name, **kwargs)
     self.constraint = constraint
Пример #4
0
 def __init__(self, name, *, constraint, **kwargs):
   Var.__init__(self, name, **kwargs)
   self.constraint = constraint