(self, value)
return value
Return a validated string or None.
Return a validated string or None.
Return a validated string or None .
def _validate(self, value):
        """Return a validated string or None."""
        if self.lock:
            return None
        value = str(value).strip()
        if not value:
            if self._data.get('allow_empty', False):
                return value
            else:
                return None
        case_sensitive = self._data.get('case_sensitive', False)
        valid_list = self._data.get('valid', None)
        if valid_list is not None:
            if not case_sensitive:
                valid_list = [i.lower() for i in valid_list]
                value = value.lower()
            if value not in valid_list:
                return None
        return value
def _validate ( self , value ) : if self . lock : return None value = str ( value ) . strip ( ) if not value : if self . _data . get ( 'allow_empty' , False ) : return value else : return None case_sensitive = self . _data . get ( 'case_sensitive' , False ) valid_list = self . _data . get ( 'valid' , None ) if valid_list is not None : if not case_sensitive : valid_list = [ i . lower ( ) for i in valid_list ] value = value . lower ( ) if value not in valid_list : return None return value