#NEWLINE# def release_hijack( request ) : #NEWLINE# #INDENT# hijack_history = request . session . get ( 'hijack_history' , False ) #NEWLINE# if ( not hijack_history ) : #NEWLINE# #INDENT# raise PermissionDenied #NEWLINE# #UNINDENT# hijacker = None #NEWLINE# hijacked = None #NEWLINE# if hijack_history : #NEWLINE# #INDENT# hijacked = request . user #NEWLINE# user_pk = hijack_history . pop ( ) #NEWLINE# hijacker = get_object_or_404 ( get_user_model ( ) , pk = user_pk ) #NEWLINE# backend = get_used_backend ( request ) #NEWLINE# hijacker . backend = ( '%s.%s' % ( backend . __module__ , backend . __class__ . __name__ ) ) #NEWLINE# login ( request , hijacker ) #NEWLINE# #UNINDENT# if hijack_history : #NEWLINE# #INDENT# request . session [ 'hijack_history' ] = hijack_history #NEWLINE# request . session [ 'is_hijacked_user' ] = True #NEWLINE# request . session [ 'display_hijack_warning' ] = True #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# request . session . pop ( 'hijack_history' , None ) #NEWLINE# request . session . pop ( 'is_hijacked_user' , None ) #NEWLINE# request . session . pop ( 'display_hijack_warning' , None ) #NEWLINE# #UNINDENT# request . session . modified = True #NEWLINE# hijack_ended . send ( sender = None , hijacker_id = hijacker . pk , hijacked_id = hijacked . pk , request = request ) #NEWLINE# return redirect_to_next ( request , default_url = hijack_settings . HIJACK_LOGOUT_REDIRECT_URL )