comparison roundup/mailgw.py @ 5396:831787cf6694

Python 3 preparation: update next() usage for iterators. Tool-assisted patch. Note that various classes in TAL code with next() methods are not actually Python iterators and so are not changed in this patch, but roundup/cgi/ZTUtils/Iterator.py includes the IterIter class which converts between the two styles of iterator.
author Joseph Myers <jsm@polyomino.org.uk>
date Tue, 24 Jul 2018 23:12:32 +0000
parents d26921b851c3
children 4cf48ff01e04
comparison
equal deleted inserted replaced
5395:23b8e6067f7c 5396:831787cf6694
1349 # handle and clear the mailbox 1349 # handle and clear the mailbox
1350 try: 1350 try:
1351 from mailbox import UnixMailbox 1351 from mailbox import UnixMailbox
1352 mailbox = UnixMailbox(f, factory=Message) 1352 mailbox = UnixMailbox(f, factory=Message)
1353 # grab one message 1353 # grab one message
1354 message = mailbox.next() 1354 message = next(mailbox)
1355 while message: 1355 while message:
1356 # handle this message 1356 # handle this message
1357 self.handle_Message(message) 1357 self.handle_Message(message)
1358 message = mailbox.next() 1358 message = next(mailbox)
1359 # nuke the file contents 1359 # nuke the file contents
1360 os.ftruncate(f.fileno(), 0) 1360 os.ftruncate(f.fileno(), 0)
1361 except: 1361 except:
1362 import traceback 1362 import traceback
1363 traceback.print_exc() 1363 traceback.print_exc()

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