Mercurial > p > roundup > code
comparison roundup/scripts/roundup_mailgw.py @ 7066:27c2d7295ba2
Changes from review
mailgw script was still using usage()
| author | Ralf Schlatterbeck <rsc@runtux.com> |
|---|---|
| date | Wed, 23 Nov 2022 21:16:01 +0100 |
| parents | 3359dc1dabb0 |
| children | f918351a0fe6 |
comparison
equal
deleted
inserted
replaced
| 7065:48da482d7d93 | 7066:27c2d7295ba2 |
|---|---|
| 228 if match: | 228 if match: |
| 229 username = match.group('user') | 229 username = match.group('user') |
| 230 password = match.group('pass') | 230 password = match.group('pass') |
| 231 server = match.group('server') | 231 server = match.group('server') |
| 232 else: | 232 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 | |
| 234 | 235 |
| 235 # now invoke the mailgw handler depending on the server handler requested | 236 # now invoke the mailgw handler depending on the server handler requested |
| 236 if source.startswith('pop'): | 237 if source.startswith('pop'): |
| 237 ssl = source.endswith('s') | 238 ssl = source.endswith('s') |
| 238 return handler.do_pop(server, username, password, ssl) | 239 return handler.do_pop(server, username, password, ssl) |
| 251 mailbox = '' | 252 mailbox = '' |
| 252 if len(args.args) > 3: | 253 if len(args.args) > 3: |
| 253 mailbox = args.args[3] | 254 mailbox = args.args[3] |
| 254 return handler.do_imap(server, username, password, mailbox, **d) | 255 return handler.do_imap(server, username, password, mailbox, **d) |
| 255 | 256 |
| 256 return usage(argv, _('Error: The source must be either "mailbox",' | 257 cmd.print_help(sys.stderr) |
| 257 ' "pop", "pops", "apop", "imap", "imaps" or' | 258 return _('\nError: The source must be either "mailbox",' |
| 258 ' "imaps_cram')) | 259 ' "pop", "pops", "apop", "imap", "imaps", ' |
| 260 ' "imaps_cram", or "imaps_oauth"') | |
| 259 | 261 |
| 260 | 262 |
| 261 def run(): | 263 def run(): |
| 262 sys.exit(main(sys.argv [1:])) | 264 sys.exit(main(sys.argv [1:])) |
| 263 | 265 |
