Skip to content

Commit ab40807

Browse files
committed
Converted send-scheduled-mail to py3
- Legacy-Id: 17332
1 parent 3728b37 commit ab40807

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

ietf/bin/send-scheduled-mail

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#!/usr/bin/env python
22

3+
# This script requires that the proper virtual python environment has been
4+
# invoked before start
5+
36
import datetime, os, sys
47
import syslog
58

@@ -8,10 +11,7 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
811
sys.path = [ basedir ] + sys.path
912
os.environ["DJANGO_SETTINGS_MODULE"] = "ietf.settings"
1013

11-
virtualenv_activation = os.path.join(basedir, "env", "bin", "activate_this.py")
12-
if os.path.exists(virtualenv_activation):
13-
execfile(virtualenv_activation, dict(__file__=virtualenv_activation))
14-
14+
# Before invoking django
1515
syslog.openlog(os.path.basename(__file__), syslog.LOG_PID, syslog.LOG_USER)
1616

1717
import django
@@ -22,9 +22,9 @@ from smtplib import SMTPException
2222

2323

2424
if len(sys.argv) != 2 or sys.argv[1] not in ('all', 'rsync', 'specific'):
25-
print "USAGE: %s <all | specific>" % os.path.basename(__file__)
26-
print "'all' means all not sent"
27-
print "'specific' means all not sent that are due to be sent"
25+
print("USAGE: %s <all | specific>" % os.path.basename(__file__))
26+
print("'all' means all not sent")
27+
print("'specific' means all not sent that are due to be sent")
2828
sys.exit(1)
2929

3030
from ietf.message.utils import send_scheduled_message_from_send_queue
@@ -41,7 +41,7 @@ if mode == "specific":
4141
for s in needs_sending:
4242
try:
4343
send_scheduled_message_from_send_queue(s)
44-
syslog.syslog(u'Sent scheduled message %s "%s"' % (s.id, s.message.subject))
44+
syslog.syslog('Sent scheduled message %s "%s"' % (s.id, s.message.subject))
4545
except SMTPException as e:
4646
log_smtp_exception(e)
4747
send_error_email(e)

0 commit comments

Comments
 (0)