#NEWLINE# def __init__( self , default , * options , **kwargs ) : #NEWLINE# #INDENT# self . default = default #NEWLINE# self . all = ( ( default , ) + options ) #NEWLINE# for val in self . all : #NEWLINE# #INDENT# if ( not isinstance ( val , string_types ) ) : #NEWLINE# #INDENT# raise ValueError ( 'Valid values for an EnumStr parameter should be strings' , val , type ( val ) ) #NEWLINE# #UNINDENT# #UNINDENT# convert = kwargs . get ( 'convert' , None ) #NEWLINE# def filter( val ) : #NEWLINE# #INDENT# if convert : #NEWLINE# #INDENT# val = convert ( val ) #NEWLINE# #UNINDENT# if ( val in self . all ) : #NEWLINE# #INDENT# return val #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise ValueError ( ( 'Invalid value ("%s") for configuration variable "%s". Valid options are %s' % ( val , self . fullname , self . all ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# over = kwargs . get ( 'allow_override' , True ) #NEWLINE# super ( EnumStr , self ) . __init__ ( default , filter , over )