Skip to content

Commit cbc2cdc

Browse files
committed
Changes from review
mailgw script was still using usage()
1 parent d3753c8 commit cbc2cdc

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

roundup/scripts/roundup_mailgw.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,8 @@ def main(argv):
230230
password = match.group('pass')
231231
server = match.group('server')
232232
else:
233-
return usage(argv, _('Error: %s specification not valid') % source)
233+
cmd.print_help(sys.stderr)
234+
return _('\nError: %s specification not valid') % source
234235

235236
# now invoke the mailgw handler depending on the server handler requested
236237
if source.startswith('pop'):
@@ -253,9 +254,10 @@ def main(argv):
253254
mailbox = args.args[3]
254255
return handler.do_imap(server, username, password, mailbox, **d)
255256

256-
return usage(argv, _('Error: The source must be either "mailbox",'
257-
' "pop", "pops", "apop", "imap", "imaps" or'
258-
' "imaps_cram'))
257+
cmd.print_help(sys.stderr)
258+
return _('\nError: The source must be either "mailbox",'
259+
' "pop", "pops", "apop", "imap", "imaps", '
260+
' "imaps_cram", or "imaps_oauth"')
259261

260262

261263
def run():

test/test_mailgw.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ def _allowAnonymousSubmit(self):
243243
]
244244
self.db.security.role['anonymous'].permissions = p
245245

246-
def _create_mailgw(self, message, args=[]):
246+
def _create_mailgw(self, message, args=()):
247247
class MailGW(self.instance.MailGW):
248248
"""call _handle_message as handle_message
249249
the real handle_message reopens the database, and destroys
@@ -256,7 +256,7 @@ def handle_message(self, message):
256256
handler.db = self.db
257257
return handler
258258

259-
def _handle_mail(self, message, args=[], trap_exc=0):
259+
def _handle_mail(self, message, args=(), trap_exc=0):
260260
handler = self._create_mailgw(message, args)
261261
handler.trapExceptions = trap_exc
262262
return handler.main(io.BytesIO(s2b(message)))

0 commit comments

Comments
 (0)