|
14 | 14 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
15 | 15 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
16 | 16 | # |
17 | | -# $Id: roundup_mailgw.py,v 1.20 2004-09-14 22:09:48 richard Exp $ |
| 17 | +# $Id: roundup_mailgw.py,v 1.20.2.1 2005-07-18 01:28:12 richard Exp $ |
18 | 18 |
|
19 | 19 | """Command-line script stub that calls the roundup.mailgw. |
20 | 20 | """ |
|
24 | 24 | from roundup import version_check |
25 | 25 | from roundup import __version__ as roundup_version |
26 | 26 |
|
27 | | -import sys, os, re, cStringIO, getopt |
| 27 | +import sys, os, re, cStringIO, getopt, socket |
28 | 28 |
|
29 | 29 | from roundup import mailgw |
30 | 30 | from roundup.i18n import _ |
@@ -146,6 +146,12 @@ def main(argv): |
146 | 146 | if len(args) < 3: |
147 | 147 | return usage(argv, _('Error: not enough source specification information')) |
148 | 148 | source, specification = args[1:3] |
| 149 | + |
| 150 | + # time out net connections after a minute if we can |
| 151 | + if source not in ('mailbox', 'imaps'): |
| 152 | + if hasattr(socket, 'setdefaulttimeout'): |
| 153 | + socket.setdefaulttimeout(60) |
| 154 | + |
149 | 155 | if source == 'mailbox': |
150 | 156 | return handler.do_mailbox(specification) |
151 | 157 | elif source == 'pop': |
@@ -182,10 +188,6 @@ def main(argv): |
182 | 188 | handler.db.close() |
183 | 189 |
|
184 | 190 | def run(): |
185 | | - # time out after a minute if we can |
186 | | - import socket |
187 | | - if hasattr(socket, 'setdefaulttimeout'): |
188 | | - socket.setdefaulttimeout(60) |
189 | 191 | sys.exit(main(sys.argv)) |
190 | 192 |
|
191 | 193 | # call main |
|
0 commit comments