Beispiel #1
0
 def validate_url(self, value):
     if not self.__class__.URI_REGEX.match(value):
         raise StopValidation(self.messages['Invalid URI'])
Beispiel #2
0
 def validate_id(self, value):
     if not isinstance(value, PackageId):
         raise StopValidation(self.messages['Invalid Package ID: must be PackageId named tuple'])
Beispiel #3
0
 def validate_data(self, value):
     if value not in self.valid_datatypes:
         raise StopValidation("not a valid dataype (one of {0})".format(
             self.valid_datatypes))
Beispiel #4
0
 def raiser(x):
     raise StopValidation({'something': 'bad'})
Beispiel #5
0
 def validate_data(self, value):
     if value not in self.valid_strings:
         raise StopValidation("not one of {0})".format(self.valid_strings))