Mercurial > p > roundup > code
diff roundup/scripts/roundup_mailgw.py @ 3386:263e8f485db5
don't try to set a timeout for IMAPS (thanks Paul Jimenez)
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Mon, 18 Jul 2005 01:19:57 +0000 |
| parents | 437775793d8e |
| children | 22ec8e91da2b |
line wrap: on
line diff
--- a/roundup/scripts/roundup_mailgw.py Tue Jul 12 01:44:30 2005 +0000 +++ b/roundup/scripts/roundup_mailgw.py Mon Jul 18 01:19:57 2005 +0000 @@ -14,7 +14,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup_mailgw.py,v 1.20 2004-09-14 22:09:48 richard Exp $ +# $Id: roundup_mailgw.py,v 1.21 2005-07-18 01:19:57 richard Exp $ """Command-line script stub that calls the roundup.mailgw. """ @@ -24,7 +24,7 @@ from roundup import version_check from roundup import __version__ as roundup_version -import sys, os, re, cStringIO, getopt +import sys, os, re, cStringIO, getopt, socket from roundup import mailgw from roundup.i18n import _ @@ -146,6 +146,12 @@ if len(args) < 3: return usage(argv, _('Error: not enough source specification information')) source, specification = args[1:3] + + # time out net connections after a minute if we can + if source not in ('mailbox', 'imaps'): + if hasattr(socket, 'setdefaulttimeout'): + socket.setdefaulttimeout(60) + if source == 'mailbox': return handler.do_mailbox(specification) elif source == 'pop': @@ -182,10 +188,6 @@ handler.db.close() def run(): - # time out after a minute if we can - import socket - if hasattr(socket, 'setdefaulttimeout'): - socket.setdefaulttimeout(60) sys.exit(main(sys.argv)) # call main
