def __init__(self, choices=None, validator=None, **kwargs):
    """Create a multichoice object and validate choices.

    Args:
      choices: list of available choices
      validator: validator to use for each of the list *items* the validator for
                 the top level is a list.
      **kwargs: passed through to parent class.
    """
    self.choices = choices
    subvalidator = validator or String()
    self.validator = List(validator=subvalidator)

    # Check the choices match the validator
    for choice in self.choices:
      subvalidator.Validate(choice)
    super(MultiChoice, self).__init__(**kwargs)
def __init__ ( self , choices = None , validator = None , ** kwargs ) : self . choices = choices subvalidator = validator or String ( ) self . validator = List ( validator = subvalidator ) for choice in self . choices : subvalidator . Validate ( choice ) super ( MultiChoice , self ) . __init__ ( ** kwargs )
Create a multichoice object and validate choices.

    Args:
      choices: list of available choices
      validator: validator to use for each of the list *items* the validator for
                 the top level is a list.
      **kwargs: passed through to parent class.