Mercurial > p > roundup > code
comparison roundup/mailgw.py @ 5401:4cf48ff01e04
Python 3 preparation: replace raw_input uses.
The existing my_input in roundup/admin.py is moved to a new
roundup/anypy/my_input.py, which is then used in more places. Manual
patch.
| author | Joseph Myers <jsm@polyomino.org.uk> |
|---|---|
| date | Tue, 24 Jul 2018 23:47:10 +0000 |
| parents | 831787cf6694 |
| children | 56c9bcdea47f |
comparison
equal
deleted
inserted
replaced
| 5400:2120f77554d5 | 5401:4cf48ff01e04 |
|---|---|
| 99 import time, random, sys, logging | 99 import time, random, sys, logging |
| 100 import traceback | 100 import traceback |
| 101 import email.utils | 101 import email.utils |
| 102 | 102 |
| 103 from .anypy.email_ import decode_header | 103 from .anypy.email_ import decode_header |
| 104 from roundup.anypy.my_input import my_input | |
| 104 | 105 |
| 105 from roundup import configuration, hyperdb, date, password, exceptions | 106 from roundup import configuration, hyperdb, date, password, exceptions |
| 106 from roundup.mailer import Mailer, MessageSendError | 107 from roundup.mailer import Mailer, MessageSendError |
| 107 from roundup.i18n import _ | 108 from roundup.i18n import _ |
| 108 from roundup.hyperdb import iter_roles | 109 from roundup.hyperdb import iter_roles |
| 1370 ''' Do an IMAP connection | 1371 ''' Do an IMAP connection |
| 1371 ''' | 1372 ''' |
| 1372 import getpass, imaplib, socket | 1373 import getpass, imaplib, socket |
| 1373 try: | 1374 try: |
| 1374 if not user: | 1375 if not user: |
| 1375 user = raw_input('User: ') | 1376 user = my_input('User: ') |
| 1376 if not password: | 1377 if not password: |
| 1377 password = getpass.getpass() | 1378 password = getpass.getpass() |
| 1378 except (KeyboardInterrupt, EOFError): | 1379 except (KeyboardInterrupt, EOFError): |
| 1379 # Ctrl C or D maybe also Ctrl Z under Windows. | 1380 # Ctrl C or D maybe also Ctrl Z under Windows. |
| 1380 print("\nAborted by user.") | 1381 print("\nAborted by user.") |
| 1459 # https://stackoverflow.com/questions/30976106/python-poplib-error-proto-line-too-+long?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa | 1460 # https://stackoverflow.com/questions/30976106/python-poplib-error-proto-line-too-+long?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa |
| 1460 if 0 < getattr (poplib, '_MAXLINE', -1) < 100*1024: | 1461 if 0 < getattr (poplib, '_MAXLINE', -1) < 100*1024: |
| 1461 poplib._MAXLINE = 100*1024 | 1462 poplib._MAXLINE = 100*1024 |
| 1462 try: | 1463 try: |
| 1463 if not user: | 1464 if not user: |
| 1464 user = raw_input('User: ') | 1465 user = my_input('User: ') |
| 1465 if not password: | 1466 if not password: |
| 1466 password = getpass.getpass() | 1467 password = getpass.getpass() |
| 1467 except (KeyboardInterrupt, EOFError): | 1468 except (KeyboardInterrupt, EOFError): |
| 1468 # Ctrl C or D maybe also Ctrl Z under Windows. | 1469 # Ctrl C or D maybe also Ctrl Z under Windows. |
| 1469 print("\nAborted by user.") | 1470 print("\nAborted by user.") |
