#NEWLINE# @ bp . route ( '/<int:uid>/move' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# @ require_user #NEWLINE# def move( uid ) : #NEWLINE# #INDENT# '\n    Move a topic to another node.\n\n    :param uid: the id of the topic\n    ' #NEWLINE# topic = Topic . query . get_or_404 ( uid ) #NEWLINE# if ( ( g . user . id != topic . account_id ) and ( not g . user . is_staff ) ) : #NEWLINE# #INDENT# return abort ( 403 ) #NEWLINE# #UNINDENT# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# return render_template ( 'topic/move.html' , topic = topic ) #NEWLINE# #UNINDENT# urlname = request . form . get ( 'node' , None ) #NEWLINE# if ( not urlname ) : #NEWLINE# #INDENT# return redirect ( url_for ( '.view' , uid = uid ) ) #NEWLINE# #UNINDENT# node = Node . query . filter_by ( urlname = urlname ) . first ( ) #NEWLINE# if node : #NEWLINE# #INDENT# topic . move ( node ) #NEWLINE# flash ( _ ( 'Move topic success.' ) , 'success' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# flash ( _ ( 'Node not found.' ) , 'error' ) #NEWLINE# #UNINDENT# return redirect ( url_for ( '.view' , uid = uid ) )