11#!/usr/bin/env python
22
3+ # This script requires that the proper virtual python environment has been
4+ # invoked before start
5+
36import datetime , os , sys
47import syslog
58
@@ -8,10 +11,7 @@ basedir = os.path.abspath(os.path.join(os.path.dirname(__file__), "../.."))
811sys .path = [ basedir ] + sys .path
912os .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
1515syslog .openlog (os .path .basename (__file__ ), syslog .LOG_PID , syslog .LOG_USER )
1616
1717import django
@@ -22,9 +22,9 @@ from smtplib import SMTPException
2222
2323
2424if 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
3030from ietf .message .utils import send_scheduled_message_from_send_queue
@@ -41,7 +41,7 @@ if mode == "specific":
4141for 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