<s> from . . widgets import SelectWidget <EOL> from . select import SelectField <EOL> class SelectMultipleField ( SelectField ) : <EOL> """<STR_LIT>""" <EOL> widget = SelectWidget ( multiple = True ) <EOL> def process_data ( self , value ) : <EOL> try : <EOL> self . data = list ( self . coerce ( v ) for v in value ) <EOL> except ( ValueError , TypeError ) : <EOL> self . data = None <EOL> def process_formdata ( self , valuelist ) : <EOL> try : <EOL> self . data = list ( self . coerce ( x ) for x in valuelist ) <EOL> except ValueError : <EOL> raise ValueError ( <EOL> self . gettext ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> ) <EOL> def pre_validate ( self , form ) : <EOL> if self . data : <EOL> values = self . choice_values <EOL> for value in self . data : <EOL> if value not in values : <EOL> raise ValueError ( <EOL> self . gettext ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> ) % dict ( value = value ) <EOL> ) </s>
