#NEWLINE# @ api . route ( '/posts/<int:id>/comments/' , methods = [ 'POST' ] ) #NEWLINE# @ permission_required ( Permission . COMMENT ) #NEWLINE# def new_post_comment( id ) : #NEWLINE# #INDENT# post = Post . query . get_or_404 ( id ) #NEWLINE# comment = Comment . from_json ( request . json ) #NEWLINE# comment . author = g . current_user #NEWLINE# comment . post = post #NEWLINE# db . session . add ( comment ) #NEWLINE# db . session . commit ( ) #NEWLINE# return ( jsonify ( comment . to_json ( ) ) , 201 , { #NEWLINE# #INDENT# 'Location' : url_for ( 'api.get_comment' , id = comment . id , _external = True ) , #NEWLINE# #UNINDENT# } )