#NEWLINE# def send_comment_notification( comment ) : #NEWLINE# #INDENT# talk = comment . talk #NEWLINE# for ( email , name ) in comment . notification_list ( ) : #NEWLINE# #INDENT# if ( not PendingEmail . already_in_queue ( email , talk ) ) : #NEWLINE# #INDENT# unsubscribe = url_for ( 'talks.unsubscribe' , token = talk . get_unsubscribe_token ( email ) , _external = True ) #NEWLINE# pending_email = PendingEmail ( name = name , email = email , subject = '[talks] New comment' , body_text = render_template ( 'email/notify.txt' , name = name , email = email , talk = talk , unsubscribe = unsubscribe ) , body_html = render_template ( 'email/notify.html' , name = name , email = email , talk = talk , unsubscribe = unsubscribe ) , talk = talk ) #NEWLINE# db . session . add ( pending_email ) #NEWLINE# db . session . flush ( ) #NEWLINE# #UNINDENT# #UNINDENT# db . session . commit ( )