<s> from flask import render_template <EOL> from app . extensions import celery , mail <EOL> from app . database import db <EOL> from celery . signals import task_postrun <EOL> from flask . ext . mail import Message <EOL> @ celery . task <EOL> def send_registration_email ( user , token ) : <EOL> msg = Message ( <EOL> '<STR_LIT>' , <EOL> sender = '<STR_LIT>' , <EOL> recipients = [ user . email ] <EOL> ) <EOL> msg . body = render_template ( <EOL> '<STR_LIT>' , <EOL> user = user , <EOL> token = token <EOL> ) <EOL> mail . send ( msg ) <EOL> @ task_postrun . connect <EOL> def close_session ( * args , ** kwargs ) : <EOL> db . session . remove ( ) </s>
