def validate_url(self, value): if not self.__class__.URI_REGEX.match(value): raise StopValidation(self.messages['Invalid URI'])
def validate_id(self, value): if not isinstance(value, PackageId): raise StopValidation(self.messages['Invalid Package ID: must be PackageId named tuple'])
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))
def raiser(x): raise StopValidation({'something': 'bad'})
def validate_data(self, value): if value not in self.valid_strings: raise StopValidation("not one of {0})".format(self.valid_strings))