Converted send-scheduled-mail to py3
- Legacy-Id: 17332
This commit is contained in:
parent
3728b37629
commit
ab40807c36
|
@ -1,5 +1,8 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# This script requires that the proper virtual python environment has been
|
||||
# invoked before start
|
||||
|
||||
import datetime, os, sys
|
||||
import syslog
|
||||
|
||||
|
@ -8,10 +11,7 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
|
|||
sys.path = [ basedir ] + sys.path
|
||||
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
|
||||
|
||||
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
|
||||
if os.path.exists(virtualenv_activation):
|
||||
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
|
||||
|
||||
# Before invoking django
|
||||
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
|
||||
|
||||
import django
|
||||
|
@ -22,9 +22,9 @@ from smtplib import SMTPException
|
|||
|
||||
|
||||
if len(sys.argv) != 2 or sys.argv[1] not in ('all', 'rsync', 'specific'):
|
||||
print "USAGE: %s <all | specific>" % os.path.basename(__file__)
|
||||
print "'all' means all not sent"
|
||||
print "'specific' means all not sent that are due to be sent"
|
||||
print("USAGE: %s <all | specific>" % os.path.basename(__file__))
|
||||
print("'all' means all not sent")
|
||||
print("'specific' means all not sent that are due to be sent")
|
||||
sys.exit(1)
|
||||
|
||||
from ietf.message.utils import send_scheduled_message_from_send_queue
|
||||
|
@ -41,7 +41,7 @@ if mode == "specific":
|
|||
for s in needs_sending:
|
||||
try:
|
||||
send_scheduled_message_from_send_queue(s)
|
||||
syslog.syslog(u'Sent scheduled message %s "%s"' % (s.id, s.message.subject))
|
||||
syslog.syslog('Sent scheduled message %s "%s"' % (s.id, s.message.subject))
|
||||
except SMTPException as e:
|
||||
log_smtp_exception(e)
|
||||
send_error_email(e)
|
||||
|
|
Loading…
Reference in a new issue