def export_to_zip_file(exploration_id, version=None):
 exploration = get_exploration_by_id(exploration_id, version=version)
 yaml_repr = exploration.to_yaml()
 memfile = StringIO.StringIO()
 with zipfile.ZipFile(memfile, mode='w', compression=zipfile.ZIP_DEFLATED) as zfile:
  zfile.writestr(('%s.yaml' % exploration.title), yaml_repr)
  fs = fs_domain.AbstractFileSystem(fs_domain.ExplorationFileSystem(exploration_id))
  dir_list = fs.listdir('')
  for filepath in dir_list:
   file_contents = fs.get(filepath, version=1)
   str_filepath = ('assets/%s' % filepath)
   assert isinstance(str_filepath, str)
   unicode_filepath = str_filepath.decode('utf-8')
   zfile.writestr(unicode_filepath, file_contents)
 return memfile.getvalue()

def export_to_zip_file ( exploration_id , version = None ) : exploration = get_exploration_by_id ( exploration_id , version = version ) yaml_repr = exploration . to_yaml ( ) memfile = StringIO . StringIO ( ) with zipfile . ZipFile ( memfile , mode = 'w' , compression = zipfile . ZIP_DEFLATED ) as zfile : zfile . writestr ( ( '%s.yaml' % exploration . title ) , yaml_repr ) fs = fs_domain . AbstractFileSystem ( fs_domain . ExplorationFileSystem ( exploration_id ) ) dir_list = fs . listdir ( '' ) for filepath in dir_list : file_contents = fs . get ( filepath , version = 1 ) str_filepath = ( 'assets/%s' % filepath ) assert isinstance ( str_filepath , str ) unicode_filepath = str_filepath . decode ( 'utf-8' ) zfile . writestr ( unicode_filepath , file_contents ) return memfile . getvalue ( )
returns a zip archive of the exploration .