def save_new_exploration_from_yaml_and_assets(committer_id, yaml_content, exploration_id, assets_list):
 if (assets_list is None):
  assets_list = []
 yaml_dict = utils.dict_from_yaml(yaml_content)
 if ('schema_version' not in yaml_dict):
  raise Exception('Invalid YAML file: missing schema version')
 exp_schema_version = yaml_dict['schema_version']
 if (exp_schema_version <= exp_domain.Exploration.LAST_UNTITLED_SCHEMA_VERSION):
  exploration = exp_domain.Exploration.from_untitled_yaml(exploration_id, feconf.DEFAULT_EXPLORATION_TITLE, feconf.DEFAULT_EXPLORATION_CATEGORY, yaml_content)
 else:
  exploration = exp_domain.Exploration.from_yaml(exploration_id, yaml_content)
 commit_message = ("New exploration created from YAML file with title '%s'." % exploration.title)
 _create_exploration(committer_id, exploration, commit_message, [{'cmd': CMD_CREATE_NEW, 'title': exploration.title, 'category': exploration.category}])
 for (asset_filename, asset_content) in assets_list:
  fs = fs_domain.AbstractFileSystem(fs_domain.ExplorationFileSystem(exploration_id))
  fs.commit(committer_id, asset_filename, asset_content)

def save_new_exploration_from_yaml_and_assets ( committer_id , yaml_content , exploration_id , assets_list ) : if ( assets_list is None ) : assets_list = [ ] yaml_dict = utils . dict_from_yaml ( yaml_content ) if ( 'schema_version' not in yaml_dict ) : raise Exception ( 'Invalid YAML file: missing schema version' ) exp_schema_version = yaml_dict [ 'schema_version' ] if ( exp_schema_version <= exp_domain . Exploration . LAST_UNTITLED_SCHEMA_VERSION ) : exploration = exp_domain . Exploration . from_untitled_yaml ( exploration_id , feconf . DEFAULT_EXPLORATION_TITLE , feconf . DEFAULT_EXPLORATION_CATEGORY , yaml_content ) else : exploration = exp_domain . Exploration . from_yaml ( exploration_id , yaml_content ) commit_message = ( "New exploration created from YAML file with title '%s'." % exploration . title ) _create_exploration ( committer_id , exploration , commit_message , [ { 'cmd' : CMD_CREATE_NEW , 'title' : exploration . title , 'category' : exploration . category } ] ) for ( asset_filename , asset_content ) in assets_list : fs = fs_domain . AbstractFileSystem ( fs_domain . ExplorationFileSystem ( exploration_id ) ) fs . commit ( committer_id , asset_filename , asset_content )
note that the default title and category will be used if the yaml schema version is less than exp_domain .