示例#1
0
 def validate(self, responses, field):
     if not isinstance(responses, set):
         raise rfx.ResponseException(self.__class__ + 'expects a set')
     if len(responses) > self.maximum:
         raise rfx.WrongNumberOfChoices(
             'limited to no more than %d choices' % (self.maximum))
     self.detect_duplicates(responses)
     self.validate_choices(responses, field)
示例#2
0
 def validate(self, responses, field):
     if len(responses) > self.maximum:
         raise rfx.WrongNumberOfChoices('rank no more than %d choices' %
                                        (self.maximum))
     super().validate(responses, field)
示例#3
0
 def validate(self, responses, field):
     if len(responses) != len(field):
         raise rfx.WrongNumberOfChoices(
             'all choices in field must be ranked')
     super().validate(responses, field)
示例#4
0
 def validate(self, responses, field):
     if len(responses) != sum(range(len(field))):
         raise rfx.WrongNumberOfChoices('must rank every pairwise possibility')
     super().validate(responses, field)
示例#5
0
 def validate(self, responses, field):
     if len(responses) != self.exactly:
         raise rfx.WrongNumberOfChoices('must choose exactly %d choices' %
                                        (self.exactly))
     self.detect_duplicates(responses)
     self.validate_choices(responses, field)