#NEWLINE# @ gen . coroutine #NEWLINE# def _Check( self ) : #NEWLINE# #INDENT# 'Gathers pre-mutation information:\n       1. List of requested episodes and photos to save.\n       2. Checkpoints list of episode and post ids that need to be (re)created.\n       3. Acquires locks for all source viewpoints.\n\n       Validates the following:\n       1. Permissions to share from source episodes.\n    ' #NEWLINE# self . _save_ep_dicts = ( yield self . _CreateSaveEpisodeDicts ( ) ) #NEWLINE# source_ep_posts_list = ( yield ViewfinderOperation . _CheckCopySources ( 'save' , self . _client , self . _user . user_id , self . _save_ep_dicts ) ) #NEWLINE# target_ep_ids = [ ep_dict [ 'new_episode_id' ] for ep_dict in self . _save_ep_dicts ] #NEWLINE# self . _target_ep_dicts = ViewfinderOperation . _CreateCopyTargetDicts ( self . _op . timestamp , self . _user . user_id , self . _user . private_vp_id , source_ep_posts_list , target_ep_ids ) #NEWLINE# for source_vp_id in set ( ( episode . viewpoint_id for ( episode , posts ) in source_ep_posts_list ) ) : #NEWLINE# #INDENT# ( yield self . _lock_tracker . AcquireViewpointLock ( source_vp_id ) ) #NEWLINE# #UNINDENT# if ( self . _op . checkpoint is None ) : #NEWLINE# #INDENT# self . _new_ids = ( yield ViewfinderOperation . _CheckCopyTargets ( 'save' , self . _client , self . _user . user_id , self . _user . private_vp_id , self . _target_ep_dicts ) ) #NEWLINE# checkpoint = { #NEWLINE# #INDENT# 'new' : list ( self . _new_ids ) , #NEWLINE# #UNINDENT# } #NEWLINE# ( yield self . _op . SetCheckpoint ( self . _client , checkpoint ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _new_ids = set ( self . _op . checkpoint [ 'new' ] ) #NEWLINE# #UNINDENT# raise gen . Return ( True )