Module Expr Str Assign NameStore ListLoad Str Import alias Import alias ImportFrom alias ImportFrom alias ImportFrom alias alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ImportFrom alias ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam defaults body Expr Str Expr Yield Call AttributeLoad Call NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad attr decorator_list NameLoad AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr TryFinally body Expr Yield Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr Expr Yield Call AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr finalbody Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign TupleStore AttributeStore NameLoad attr AttributeStore NameLoad attr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If BoolOpOr CompareIs AttributeLoad NameLoad attr NameLoad UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr body Raise Call NameLoad BinOpMod Str TupleLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assert CompareIsNot AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign TupleStore AttributeStore NameLoad attr NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Yield Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore ListComp SubscriptLoad NameLoad Index Str comprehension NameStore AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If CompareIs AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign AttributeStore NameLoad attr Yield Call AttributeLoad NameLoad attr Str AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr BoolOpAnd UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Dict Str Str Str Call NameLoad AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield Call AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr NameLoad orelse Assign AttributeStore NameLoad attr Call NameLoad SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str Assign AttributeStore NameLoad attr SubscriptLoad AttributeLoad AttributeLoad NameLoad attr attr Index Str Raise Call AttributeLoad NameLoad attr NameLoad decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr If AttributeLoad NameLoad attr body Assign AttributeStore AttributeLoad NameLoad attr attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListComp SubscriptLoad Call AttributeLoad NameLoad attr NameLoad Index Num comprehension NameStore AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Assign NameStore Call NameLoad Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad ListComp AttributeLoad NameLoad attr comprehension NameStore AttributeLoad NameLoad attr UnaryOpNot Call AttributeLoad NameLoad attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad AttributeLoad NameLoad attr attr Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr decorator_list AttributeLoad NameLoad attr FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore ListComp SubscriptLoad NameLoad Index Str comprehension NameStore AttributeLoad NameLoad attr For NameStore AttributeLoad NameLoad attr body If UnaryOpNot Call AttributeLoad NameLoad attr body Continue If Call AttributeLoad NameLoad attr body Continue Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad If CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr body If Call NameLoad GeneratorExp CompareEq AttributeLoad NameLoad attr AttributeLoad NameLoad attr comprehension TupleStore NameStore NameStore AttributeLoad NameLoad attr body Continue Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Num Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Index Str AttributeLoad NameLoad attr BinOpAdd NameLoad Num Assign NameStore Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr NameLoad Assign NameStore ListLoad For TupleStore NameStore NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad body Expr Call AttributeLoad NameLoad attr Dict Str Str Str SubscriptLoad NameLoad Index Str NameLoad SubscriptLoad NameLoad Index Str Assign NameStore Dict Str Str Str Str Dict Str Str NameLoad AttributeLoad AttributeLoad NameLoad attr attr AttributeLoad NameLoad attr Dict Str Str NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Str NameLoad Expr Yield Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr AttributeLoad NameLoad attr Str NameLoad decorator_list AttributeLoad NameLoad attr decorator_list
N/A N/A Viewfinder ShareExistingOperation.

This operation shares existing episodes and photos into an existing viewpoint.
 N/A __authors__ N/A andy@emailscrubbed.com (Andy Kimball) N/A json N/A logging copy deepcopy tornado gen viewfinder.backend.base.exceptions InvalidRequestError LimitExceededError PermissionError viewfinder.backend.db.accounting AccountingAccumulator viewfinder.backend.db.activity Activity viewfinder.backend.db.asset_id IdPrefix viewfinder.backend.db.db_client DBClient DBKey viewfinder.backend.db.episode Episode viewfinder.backend.db.follower Follower viewfinder.backend.db.operation Operation viewfinder.backend.db.post Post viewfinder.backend.db.user User viewfinder.backend.db.viewpoint Viewpoint viewfinder.backend.op.notification_manager NotificationManager viewfinder.backend.op.viewfinder_op ViewfinderOperation ShareExistingOperation N/A ViewfinderOperation N/A N/A The ShareExisting operation follows the four phase pattern described in the header of
  operation_map.py.
   __init__ N/A N/A self client act_dict user_id viewpoint_id ep_dicts N/A N/A N/A N/A N/A N/A super ShareExistingOperation self __init__ client N/A N/A self _act_dict act_dict N/A N/A self _user_id user_id N/A N/A self _viewpoint_id viewpoint_id N/A N/A self _ep_dicts ep_dicts N/A Execute N/A N/A cls client activity user_id viewpoint_id episodes N/A N/A N/A Entry point called by the operation framework. N/A N/A N/A N/A N/A ShareExistingOperation client activity user_id viewpoint_id episodes _ShareExisting N/A classmethod N/A gen coroutine _ShareExisting N/A N/A self N/A N/A N/A Orchestrates the share_existing operation by executing each of the phases in turn. N/A lock N/A N/A N/A gen Task N/A Viewpoint AcquireLock N/A self _client N/A self _viewpoint_id N/A N/A N/A N/A N/A N/A self _Check N/A N/A N/A N/A self _client CheckDBNotModified N/A N/A N/A N/A self _Update N/A N/A N/A N/A self _Account N/A N/A N/A N/A Operation TriggerFailpoint N/A self _client N/A N/A N/A N/A self _Notify N/A N/A N/A N/A self _AutoSave N/A N/A N/A N/A N/A gen Task N/A Viewpoint ReleaseLock N/A self _client N/A self _viewpoint_id lock N/A N/A gen coroutine _Check N/A N/A self N/A N/A N/A Gathers pre-mutation information:
       1. Existing viewpoint and owner follower.
       2. Followers of the existing viewpoint.
       3. List of requested episodes and photos to share.
       4. Checkpoints list of episode and post ids that need to be (re)created.
       5. Checkpoints list of followers that need to be revived.
       6. Checkpoints boolean indicating whether cover photo needs to be set.

       Validates the following:
       1. Permissions to share from source episodes.
       2. Permission to share into existing viewpoint.
     N/A N/A N/A self _viewpoint N/A self _follower N/A N/A N/A gen Task N/A Viewpoint QueryWithFollower N/A self _client N/A self _user_id N/A self _viewpoint_id N/A N/A N/A N/A self _follower None N/A N/A N/A N/A self _follower CanContribute N/A N/A N/A PermissionError N/A User %d does not have permission to contribute to viewpoint "%s". N/A N/A self _user_id N/A self _viewpoint_id N/A N/A N/A self _viewpoint None N/A self _viewpoint_id N/A N/A N/A self _followers _ N/A N/A N/A gen Task N/A Viewpoint QueryFollowers N/A self _client N/A self _viewpoint_id limit N/A Viewpoint MAX_FOLLOWERS N/A N/A self _source_ep_posts_list N/A N/A N/A ViewfinderOperation _CheckCopySources share N/A self _client N/A self _user_id N/A self _ep_dicts N/A target_ep_ids N/A N/A ep_dict N/A new_episode_id N/A ep_dict N/A self _ep_dicts N/A N/A self _new_ep_dicts N/A N/A ViewfinderOperation _CreateCopyTargetDicts N/A N/A self _op timestamp N/A self _user_id N/A self _viewpoint_id N/A self _source_ep_posts_list target_ep_ids N/A N/A N/A N/A self _op checkpoint None N/A N/A N/A self _new_ids N/A N/A N/A self _CheckCopyTargets share N/A self _client N/A self _user_id N/A self _viewpoint_id N/A self _new_ep_dicts N/A N/A self _revive_follower_ids N/A N/A self _GetRevivableFollowers N/A self _followers N/A N/A self _need_cover_photo N/A N/A N/A N/A N/A self _viewpoint IsDefault N/A N/A N/A N/A self _viewpoint IsCoverPhotoSet N/A checkpoint N/A new revive cover N/A list N/A self _new_ids N/A self _revive_follower_ids N/A self _need_cover_photo N/A N/A N/A N/A N/A self _op SetCheckpoint N/A self _client checkpoint N/A N/A N/A self _new_ids N/A set N/A N/A N/A self _op checkpoint N/A new N/A N/A self _revive_follower_ids N/A N/A N/A self _op checkpoint N/A revive N/A N/A self _need_cover_photo N/A N/A N/A self _op checkpoint N/A cover N/A N/A N/A gen Return True N/A N/A gen coroutine _Update N/A N/A self N/A N/A N/A Updates the database:
       1. Revives any followers that have removed the viewpoint.
       2. Creates new episodes and posts.
       3. Creates cover photo, if needed.
     N/A N/A N/A N/A gen Task N/A Follower ReviveRemovedFollowers N/A self _client N/A self _followers N/A N/A N/A N/A self _CreateNewEpisodesAndPosts N/A self _new_ep_dicts N/A self _new_ids N/A N/A self _need_cover_photo N/A N/A N/A N/A self _viewpoint cover_photo N/A N/A Viewpoint SelectCoverPhotoFromEpDicts N/A self _new_ep_dicts N/A N/A N/A N/A gen Task N/A N/A self _viewpoint Update N/A self _client N/A N/A gen coroutine _Account N/A N/A self N/A N/A N/A Makes accounting changes:
       1. For revived followers.
       2. For new photos that were shared.
     N/A photo_ids N/A N/A N/A N/A Post DeconstructPostId id N/A 1 N/A id N/A self _new_ids N/A N/A id startswith N/A IdPrefix Post N/A acc_accum N/A AccountingAccumulator N/A N/A N/A N/A acc_accum ReviveFollowers N/A self _client N/A self _viewpoint_id N/A self _revive_follower_ids N/A N/A N/A N/A acc_accum SharePhotos N/A self _client N/A self _user_id N/A self _viewpoint_id photo_ids N/A N/A follower user_id N/A follower N/A self _followers N/A N/A N/A follower IsRemoved N/A N/A N/A N/A acc_accum Apply N/A self _client N/A N/A gen coroutine _Notify N/A N/A self N/A N/A N/A Creates notifications:
       1. Notifies removed followers that conversation has new activity.
       2. Notifies existing followers of the viewpoint that photos have been added.
     N/A N/A N/A N/A NotificationManager NotifyReviveFollowers N/A self _client N/A self _viewpoint_id N/A self _revive_follower_ids N/A N/A self _op timestamp N/A N/A N/A N/A NotificationManager NotifyShareExisting N/A self _client N/A self _viewpoint_id N/A self _followers N/A self _act_dict N/A self _ep_dicts N/A self _need_cover_photo N/A N/A gen coroutine _AutoSave N/A N/A self N/A N/A N/A For each follower that has enabled auto-save for this viewpoint, trigger save_photos
    operation that will save the shared photos to their default viewpoint.
     N/A source_ep_ids N/A N/A ep_dict N/A new_episode_id N/A ep_dict N/A self _ep_dicts N/A follower N/A self _followers N/A N/A N/A N/A N/A follower ShouldAutoSave N/A N/A N/A N/A N/A follower IsRemoved N/A N/A N/A follower_user N/A N/A N/A gen Task N/A User Query N/A self _client N/A follower user_id None N/A N/A N/A follower_user user_id N/A self _user_id N/A N/A N/A all N/A N/A N/A source_episode viewpoint_id N/A follower_user private_vp_id N/A N/A source_episode posts N/A self _source_ep_posts_list N/A N/A N/A first_id N/A N/A N/A gen Task N/A User AllocateAssetIds N/A self _client N/A follower user_id 2 N/A op_id N/A N/A Operation ConstructOperationId N/A follower_user webapp_dev_id first_id N/A activity_id N/A N/A Activity ConstructActivityId N/A N/A self _act_dict N/A timestamp N/A follower_user webapp_dev_id N/A first_id 1 N/A target_ep_ids N/A N/A N/A ViewfinderOperation _AllocateTargetEpisodeIds N/A self _client N/A follower user_id N/A follower_user webapp_dev_id N/A follower_user private_vp_id source_ep_ids N/A target_eps_list N/A N/A N/A ep_dict target_ep_id N/A zip N/A self _ep_dicts target_ep_ids N/A N/A N/A N/A target_eps_list append N/A existing_episode_id new_episode_id photo_ids N/A ep_dict N/A new_episode_id target_ep_id N/A ep_dict N/A photo_ids N/A save_photos_dict N/A headers user_id activity episodes N/A op_id op_timestamp op_id N/A N/A self _op timestamp N/A follower user_id N/A activity_id timestamp activity_id N/A N/A self _act_dict N/A timestamp target_eps_list N/A N/A N/A N/A gen Task N/A Operation CreateAndExecute N/A N/A DBClient Instance N/A follower user_id N/A follower_user webapp_dev_id SavePhotosOperation.Execute save_photos_dict N/A N/A gen coroutine N/A