comparison scripts/roundup-reminder @ 5418:55f09ca366c4

Python 3 preparation: StringIO. This generally arranges for StringIO and cStringIO references to use io.StringIO for Python 3 but io.BytesIO for Python 2, consistent with the string representations generally used in Roundup. A special FasterStringIO in the TAL code, which referenced internals of the old Python 2 StringIO module, is cut down so it doesn't actually do anything beyond the StringIO class it inherits from (it would also be reasonable to remove FasterStringIO completely). One place in roundup_server.py clearly needing binary I/O is made to use io.BytesIO unconditionally.
author Joseph Myers <jsm@polyomino.org.uk>
date Wed, 25 Jul 2018 09:08:29 +0000
parents 3fa026621f69
children e124d76311e0
comparison
equal deleted inserted replaced
5417:c749d6795bc2 5418:55f09ca366c4
26 TODO: introduce some structure ;) 26 TODO: introduce some structure ;)
27 TODO: possibly make this more general and configurable... 27 TODO: possibly make this more general and configurable...
28 ''' 28 '''
29 29
30 from __future__ import print_function 30 from __future__ import print_function
31 import sys, cStringIO, MimeWriter, smtplib 31 import sys, MimeWriter, smtplib
32 from roundup import instance, date 32 from roundup import instance, date
33 from roundup.mailer import SMTPConnection 33 from roundup.mailer import SMTPConnection
34 from roundup.anypy.strings import StringIO
34 35
35 # open the instance 36 # open the instance
36 if len(sys.argv) != 2: 37 if len(sys.argv) != 2:
37 print('You need to specify an instance home dir') 38 print('You need to specify an instance home dir')
38 instance_home = sys.argv[1] 39 instance_home = sys.argv[1]
69 l.sort(key=listKey) 70 l.sort(key=listKey)
70 if not l: 71 if not l:
71 continue 72 continue
72 73
73 # generate the email message 74 # generate the email message
74 message = cStringIO.StringIO() 75 message = StringIO()
75 writer = MimeWriter.MimeWriter(message) 76 writer = MimeWriter.MimeWriter(message)
76 writer.addheader('Subject', 'Your active %s issues'%db.config.TRACKER_NAME) 77 writer.addheader('Subject', 'Your active %s issues'%db.config.TRACKER_NAME)
77 writer.addheader('To', address) 78 writer.addheader('To', address)
78 writer.addheader('From', '%s <%s>'%(db.config.TRACKER_NAME, 79 writer.addheader('From', '%s <%s>'%(db.config.TRACKER_NAME,
79 db.config.ADMIN_EMAIL)) 80 db.config.ADMIN_EMAIL))

Roundup Issue Tracker: http://roundup-tracker.org/