def validate_direct_mode(self, value): if value.lower() not in ['on', 'off']: raise ValidationError( "invalid value '{}', only 'on' or 'off' are accepted".format( value))
def validate_game_id(self, value): if value not in self.games: raise ValidationError("Unknown game-id '{}'".format(value))
def validate_overwrite(self, value): if value.lower() != 'overwrite': raise ValidationError( "invalid value '{}', only 'overwrite' is accepted".format( value))
def validate_savegame_name(self, value): if not re.match(r'^[a-zA-Z0-9-]+$', value): raise ValidationError( "Filename '{}' should only contain a-z, A-Z, 0-9 or - ".format( value))