<s> from mongoengine . base import BaseField <EOL> __all__ = ( '<STR_LIT>' ) <EOL> class WtfBaseField ( BaseField ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , validators = None , filters = None , ** kwargs ) : <EOL> self . validators = self . _ensure_callable_or_list ( validators , '<STR_LIT>' ) <EOL> self . filters = self . _ensure_callable_or_list ( filters , '<STR_LIT>' ) <EOL> BaseField . __init__ ( self , ** kwargs ) <EOL> def _ensure_callable_or_list ( self , field , msg_flag ) : <EOL> """<STR_LIT>""" <EOL> if field is not None : <EOL> if callable ( field ) : <EOL> field = [ field ] <EOL> else : <EOL> msg = "<STR_LIT>" % msg_flag <EOL> if not isinstance ( field , list ) : <EOL> raise TypeError ( msg ) <EOL> return field </s>
