|
@@ -46,14 +46,14 @@ def mailer_tasks(config): |
|
|
Mail_template = Template(filename='jm2l/templates/mail_html.mako') |
|
|
Mail_template = Template(filename='jm2l/templates/mail_html.mako') |
|
|
mail_html = Mail_template.render(request=request, User=StaffUser, Contact=Contact, action="Tasks") |
|
|
mail_html = Mail_template.render(request=request, User=StaffUser, Contact=Contact, action="Tasks") |
|
|
# Prepare Message |
|
|
# Prepare Message |
|
|
message = Message(subject="[JM2L] Rappel des Tâches pour les JM2L".decode('utf-8'), |
|
|
|
|
|
|
|
|
message = Message(subject="[JM2L] Le mail de rappel pour les JM2L !", |
|
|
sender="contact@jm2l.linux-azur.org", |
|
|
sender="contact@jm2l.linux-azur.org", |
|
|
recipients=[StaffUser.mail], |
|
|
recipients=[StaffUser.mail], |
|
|
body=mail_plain, html=mail_html) |
|
|
body=mail_plain, html=mail_html) |
|
|
|
|
|
|
|
|
message.add_bcc("spam@style-python.fr") |
|
|
message.add_bcc("spam@style-python.fr") |
|
|
|
|
|
|
|
|
mailer.send(message) |
|
|
|
|
|
|
|
|
mailer.send_immediately(message) |
|
|
|
|
|
|
|
|
def main(global_config, **settings): |
|
|
def main(global_config, **settings): |
|
|
""" This function returns a Pyramid WSGI application. |
|
|
""" This function returns a Pyramid WSGI application. |
|
@@ -76,7 +76,6 @@ def main(global_config, **settings): |
|
|
config.add_subscriber(add_renderer_globals, BeforeRender) |
|
|
config.add_subscriber(add_renderer_globals, BeforeRender) |
|
|
config.registry['mailer'] = mailer_factory_from_settings(settings) |
|
|
config.registry['mailer'] = mailer_factory_from_settings(settings) |
|
|
sched = BackgroundScheduler() |
|
|
sched = BackgroundScheduler() |
|
|
#sched.add_job(mailer_tasks, 'interval', minutes=1, args=[ config ]) |
|
|
|
|
|
sched.add_job(mailer_tasks, 'cron', day_of_week='fri', hour=18, args=[ config ]) |
|
|
sched.add_job(mailer_tasks, 'cron', day_of_week='fri', hour=18, args=[ config ]) |
|
|
sched.start() # start the scheduler |
|
|
sched.start() # start the scheduler |
|
|
config.add_renderer('json', JSON(indent=4)) |
|
|
config.add_renderer('json', JSON(indent=4)) |
|
|