def validate_type ( self , type_ ) : if type_ is not None and type_ not in self . types_set : raise ValueError ( 'Invalid type for %s:%s' % ( self . __class__ , type_ ) )
how to specify stringfield validators errors in python
Take an str / unicode type_ and raise a ValueError if it s not a valid type for the object . A valid type for a field is a value from the types_set attribute of that field s class .
def validate_type(self, type_):
        """Take an str/unicode `type_` and raise a ValueError if it's not 
        a valid type for the object.
        
        A valid type for a field is a value from the types_set attribute of 
        that field's class. 
        
        """
        if type_ is not None and type_ not in self.types_set:
            raise ValueError('Invalid type for %s:%s' % (self.__class__, type_))