#NEWLINE# @ mod . route ( '/comments/submit/' , methods = [ 'POST' ] ) #NEWLINE# @ requires_login #NEWLINE# def submit_comment( ) : #NEWLINE# #INDENT# '\n    Submit comments via ajax\n    ' #NEWLINE# thread_id = int ( request . form [ 'thread_id' ] ) #NEWLINE# comment_text = request . form [ 'comment_text' ] #NEWLINE# comment_parent_id = request . form [ 'parent_id' ] #NEWLINE# if ( not comment_text ) : #NEWLINE# #INDENT# abort ( 404 ) #NEWLINE# #UNINDENT# thread = Thread . query . get_or_404 ( int ( thread_id ) ) #NEWLINE# comment = thread . add_comment ( comment_text , comment_parent_id , g . user . id ) #NEWLINE# return jsonify ( comment_text = comment . text , date = comment . pretty_date ( ) , username = g . user . username , comment_id = comment . id , margin_left = comment . get_margin_left ( ) )