#NEWLINE# def after_fork( self , node , fork , user , save = True ) : #NEWLINE# #INDENT# 'After forking, copy user settings if the user is the one who authorized\n        the addon.\n\n        :return: A tuple of the form (cloned_settings, message)\n        ' #NEWLINE# ( clone , _ ) = super ( AddonOAuthNodeSettingsBase , self ) . after_fork ( node = node , fork = fork , user = user , save = False ) #NEWLINE# if ( self . has_auth and ( self . user_settings . owner == user ) ) : #NEWLINE# #INDENT# metadata = None #NEWLINE# if self . complete : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# metadata = self . user_settings . oauth_grants [ node . _id ] [ self . external_account . _id ] #NEWLINE# #UNINDENT# except ( KeyError , AttributeError ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# clone . set_auth ( self . external_account , save , metadata = metadata , log = False ) #NEWLINE# message = '{addon} authorization copied to forked {category}.' . format ( addon = self . config . full_name , category = fork . project_or_component ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# message = '{addon} authorization not copied to forked {category}. You may authorize this fork on the <u><a href="{url}">Settings</a></u> page.' . format ( addon = self . config . full_name , url = fork . web_url_for ( 'node_setting' ) , category = fork . project_or_component ) #NEWLINE# #UNINDENT# if save : #NEWLINE# #INDENT# clone . save ( ) #NEWLINE# #UNINDENT# return ( clone , message )