Show leadership when and where mail was sent at the time it is sent. Commit ready for merge.
- Legacy-Id: 9608
This commit is contained in:
parent
374e77ba2c
commit
85cfe0ed8a
|
@ -435,8 +435,8 @@ class RescheduleOnAgendaTests(TestCase):
|
||||||
r = self.client.get(url)
|
r = self.client.get(url)
|
||||||
self.assertEqual(r.status_code, 200)
|
self.assertEqual(r.status_code, 200)
|
||||||
d_header_pos = r.content.find("IESG telechat %s" % d.isoformat())
|
d_header_pos = r.content.find("IESG telechat %s" % d.isoformat())
|
||||||
draft_pos = r.content.find(draft.name)
|
draft_pos = r.content[d_header_pos:].find(draft.name)
|
||||||
self.assertTrue(d_header_pos < draft_pos)
|
self.assertTrue(draft_pos>0)
|
||||||
|
|
||||||
self.assertTrue(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat"))
|
self.assertTrue(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat"))
|
||||||
self.assertEqual(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat").telechat_date, d)
|
self.assertEqual(draft.latest_event(TelechatDocEvent, "scheduled_for_telechat").telechat_date, d)
|
||||||
|
|
|
@ -21,6 +21,7 @@ import time
|
||||||
import copy
|
import copy
|
||||||
import textwrap
|
import textwrap
|
||||||
import traceback
|
import traceback
|
||||||
|
import datetime
|
||||||
|
|
||||||
# Testing mode:
|
# Testing mode:
|
||||||
# import ietf.utils.mail
|
# import ietf.utils.mail
|
||||||
|
@ -228,6 +229,19 @@ def condition_message(to, frm, subject, msg, cc, extra):
|
||||||
if v:
|
if v:
|
||||||
msg[k] = v
|
msg[k] = v
|
||||||
|
|
||||||
|
def show_that_mail_was_sent(request,leadline,msg,bcc):
|
||||||
|
if request and request.user:
|
||||||
|
from ietf.ietfauth.utils import has_role
|
||||||
|
if has_role(request.user,['Area Director','Secretariat','IANA','RFC Editor','ISE','IAD','IRTF Chair','WG Chair','RG Chair','WG Secretary','RG Secretary']):
|
||||||
|
info = "%s at %s %s\n" % (leadline,datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"),settings.TIME_ZONE)
|
||||||
|
info += "Subject: %s\n" % msg.get('Subject','[no subject]')
|
||||||
|
info += "To: %s\n" % msg.get('To','[no to]')
|
||||||
|
if msg.get('Cc'):
|
||||||
|
info += "Cc: %s\n" % msg.get('Cc')
|
||||||
|
if bcc:
|
||||||
|
info += "Bcc: %s\n" % bcc
|
||||||
|
messages.info(request,info,extra_tags='preformatted',fail_silently=True)
|
||||||
|
|
||||||
def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=False, bcc=None):
|
def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=False, bcc=None):
|
||||||
"""Send MIME message with content already filled in."""
|
"""Send MIME message with content already filled in."""
|
||||||
|
|
||||||
|
@ -238,6 +252,9 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
|
||||||
# and EMAIL_PORT=2025 in settings_local.py
|
# and EMAIL_PORT=2025 in settings_local.py
|
||||||
debugging = getattr(settings, "USING_DEBUG_EMAIL_SERVER", False) and settings.EMAIL_HOST == 'localhost' and settings.EMAIL_PORT == 2025
|
debugging = getattr(settings, "USING_DEBUG_EMAIL_SERVER", False) and settings.EMAIL_HOST == 'localhost' and settings.EMAIL_PORT == 2025
|
||||||
|
|
||||||
|
if settings.SERVER_MODE == 'development':
|
||||||
|
show_that_mail_was_sent(request,'In production, email would have been sent',msg,bcc)
|
||||||
|
|
||||||
if test_mode or debugging or settings.SERVER_MODE == 'production':
|
if test_mode or debugging or settings.SERVER_MODE == 'production':
|
||||||
try:
|
try:
|
||||||
send_smtp(msg,bcc)
|
send_smtp(msg,bcc)
|
||||||
|
@ -245,6 +262,8 @@ def send_mail_mime(request, to, frm, subject, msg, cc=None, extra=None, toUser=F
|
||||||
log_smtp_exception(e)
|
log_smtp_exception(e)
|
||||||
build_warning_message(request, e)
|
build_warning_message(request, e)
|
||||||
send_error_email(e)
|
send_error_email(e)
|
||||||
|
|
||||||
|
show_that_mail_was_sent(request,'Email was sent',msg,bcc)
|
||||||
|
|
||||||
elif settings.SERVER_MODE == 'test':
|
elif settings.SERVER_MODE == 'test':
|
||||||
if toUser:
|
if toUser:
|
||||||
|
|
|
@ -178,6 +178,10 @@ pre {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.preformatted {
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
/* Make ampersands pretty */
|
/* Make ampersands pretty */
|
||||||
/* This sets ampersand in a different font than the rest of the text. Fancy, but it's
|
/* This sets ampersand in a different font than the rest of the text. Fancy, but it's
|
||||||
really better to select a pretty font in the first place. Additionally, _which_ 'pretty'
|
really better to select a pretty font in the first place. Additionally, _which_ 'pretty'
|
||||||
|
|
Loading…
Reference in a new issue