@@ -27,13 +27,14 @@ TODO: introduce some structure ;)
2727TODO: possibly make this more general and configurable...
2828'''
2929
30+ from __future__ import print_function
3031import sys , cStringIO , MimeWriter , smtplib
3132from roundup import instance , date
3233from roundup .mailer import SMTPConnection
3334
3435# open the instance
3536if len (sys .argv ) != 2 :
36- print 'You need to specify an instance home dir'
37+ print ( 'You need to specify an instance home dir' )
3738instance_home = sys .argv [1 ]
3839instance = instance .open (instance_home )
3940db = instance .open ('admin' )
@@ -94,32 +95,32 @@ for user_id in db.user.list():
9495 body = part .startbody ('text/plain' )
9596
9697 # do the plain text bit
97- print >> body , 'Created ID Activity Title'
98- print >> body , '=' * 75
98+ print ( 'Created ID Activity Title' , file = body )
99+ print ( '=' * 75 , file = body )
99100 # '2 months 213 immediate cc_daemon barfage
100101 old_priority = None
101102 for priority_order , activity_date , creation_date , issue_id in l :
102103 priority = db .issue .get (issue_id , 'priority' )
103104 if (priority != old_priority ):
104105 old_priority = priority
105- print >> body , ' ' , db .priority .get (priority ,'name' )
106+ print ( ' ' , db .priority .get (priority ,'name' ), file = body )
106107 # pretty creation
107108 creation = (creation_date - date .Date ('.' )).pretty ()
108109 activity = (activity_date - date .Date ('.' )).pretty ()
109110 title = db .issue .get (issue_id , 'title' )
110111 if len (title ) > 42 :
111112 title = title [:38 ] + ' ...'
112- print >> body , '%-11s %-4s %-9s %-42s' % (creation , issue_id ,
113- activity , title )
113+ print ( '%-11s %-4s %-9s %-42s' % (creation , issue_id ,
114+ activity , title ), file = body )
114115
115116 # some help to finish off
116- print >> body , '''
117+ print ( '''
117118To view or respond to any of the issues listed above, visit the URL
118119
119120 %s
120121
121122and click on "My Issues". Do NOT respond to this message.
122- ''' % db .config .TRACKER_WEB
123+ ''' % db .config .TRACKER_WEB , file = body )
123124
124125
125126 # now the HTML one
@@ -132,27 +133,27 @@ and click on "My Issues". Do NOT respond to this message.
132133 'month' : ' bgcolor="#ffffcd"' ,
133134 'whenever' : ' bgcolor="#ffffff"' ,
134135 }
135- print >> body , '''<table border>
136+ print ( '''<table border>
136137<tr><th>Created</th> <th>ID</th> <th>Activity</th> <th>Title</th></tr>
137- '''
138+ ''' , file = body )
138139 old_priority = None
139140 for priority_order , activity_date , creation_date , issue_id in l :
140141 priority = db .issue .get (issue_id ,'priority' )
141142 if (priority != old_priority ):
142143 old_priority = priority
143- print >> body , '<tr><td>-></td><td>-></td><td>-></td><td><b>%s</b></td></tr>' % db .priority .get (priority ,'name' )
144+ print ( '<tr><td>-></td><td>-></td><td>-></td><td><b>%s</b></td></tr>' % db .priority .get (priority ,'name' ), file = body )
144145 creation = (creation_date - date .Date ('.' )).pretty ()
145146 title = db .issue .get (issue_id , 'title' )
146147 issue_id = '<a href="%sissue%s">%s</a>' % (db .config .TRACKER_WEB ,
147148 issue_id , issue_id )
148149 activity = (activity_date - date .Date ('.' )).pretty ()
149- print >> body , '''<tr><td>%s</td><td>%s</td><td>%s</td>
150- <td>%s</td></tr>''' % (creation , issue_id , activity , title )
151- print >> body , '</table>'
150+ print ( '''<tr><td>%s</td><td>%s</td><td>%s</td>
151+ <td>%s</td></tr>''' % (creation , issue_id , activity , title ), file = body )
152+ print ( '</table>' , file = body )
152153
153- print >> body , '''<p>To view or respond to any of the issues listed
154+ print ( '''<p>To view or respond to any of the issues listed
154155 above, simply click on the issue ID. Do <b>not</b> respond to
155- this message.</p>'''
156+ this message.</p>''' , file = body )
156157
157158 # finish of the multipart
158159 writer .lastpart ()
0 commit comments