diff hgext/hgcia.py @ 16688:cfb6682961b8

cleanup: replace naked excepts with more specific ones
author Brodie Rao <brodie@sf.io>
date Sat, 12 May 2012 16:02:45 +0200
parents 55a85a55f020
children 38caf405d010
line wrap: on
line diff
--- a/hgext/hgcia.py	Sat May 12 16:00:58 2012 +0200
+++ b/hgext/hgcia.py	Sat May 12 16:02:45 2012 +0200
@@ -46,17 +46,14 @@
 from mercurial import cmdutil, patch, templater, util, mail
 import email.Parser
 
-import xmlrpclib
+import socket, xmlrpclib
 from xml.sax import saxutils
 
 socket_timeout = 30 # seconds
-try:
+if util.safehasattr(socket, 'setdefaulttimeout'):
     # set a timeout for the socket so you don't have to wait so looooong
     # when cia.vc is having problems. requires python >= 2.3:
-    import socket
     socket.setdefaulttimeout(socket_timeout)
-except:
-    pass
 
 HGCIA_VERSION = '0.1'
 HGCIA_URL = 'http://hg.kublai.com/mercurial/hgcia'