#NEWLINE# @ bp . route ( '/<int:uid>/edit' , methods = [ 'GET' , 'POST' ] ) #NEWLINE# @ require_user #NEWLINE# def edit( uid ) : #NEWLINE# #INDENT# '\n    Edit a topic by the topic author.\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# form = TopicForm ( obj = uid ) #NEWLINE# if form . validate_on_submit ( ) : #NEWLINE# #INDENT# form . populate_obj ( topic ) #NEWLINE# topic . save ( ) #NEWLINE# return redirect ( url_for ( '.view' , uid = uid ) ) #NEWLINE# #UNINDENT# return render_template ( 'topic/edit.html' , topic = topic , form = form )