comparison roundup/scripts/roundup_server.py @ 5248:198b6e810c67

Use Python-3-compatible 'as' syntax for except statements Many raise statements near these are also fixed. So are two ivorrect file encoding marks ('utf8'->'utf-8').
author Eric S. Raymond <esr@thyrsus.com>
date Thu, 24 Aug 2017 22:21:37 -0400
parents a9ace22e0a2f
children e9158c0a6eba
comparison
equal deleted inserted replaced
5247:7f00a47b3559 5248:198b6e810c67
202 """ 202 """
203 try: 203 try:
204 self.inner_run_cgi() 204 self.inner_run_cgi()
205 except client.NotFound: 205 except client.NotFound:
206 self.send_error(404, self.path) 206 self.send_error(404, self.path)
207 except client.Unauthorised, message: 207 except client.Unauthorised as message:
208 self.send_error(403, '%s (%s)'%(self.path, message)) 208 self.send_error(403, '%s (%s)'%(self.path, message))
209 except: 209 except:
210 exc, val, tb = sys.exc_info() 210 exc, val, tb = sys.exc_info()
211 if hasattr(socket, 'timeout') and isinstance(val, socket.timeout): 211 if hasattr(socket, 'timeout') and isinstance(val, socket.timeout):
212 self.log_error('timeout') 212 self.log_error('timeout')
675 args = ((self["HOST"], self["PORT"]), RequestHandler) 675 args = ((self["HOST"], self["PORT"]), RequestHandler)
676 kwargs = {} 676 kwargs = {}
677 if self["SSL"]: 677 if self["SSL"]:
678 kwargs['ssl_pem'] = self["PEM"] 678 kwargs['ssl_pem'] = self["PEM"]
679 httpd = server_class(*args, **kwargs) 679 httpd = server_class(*args, **kwargs)
680 except socket.error, e: 680 except socket.error as e:
681 if e[0] == errno.EADDRINUSE: 681 if e[0] == errno.EADDRINUSE:
682 raise socket.error, \ 682 raise socket.error, \
683 _("Unable to bind to port %s, port already in use.") \ 683 _("Unable to bind to port %s, port already in use.") \
684 % self["PORT"] 684 % self["PORT"]
685 raise 685 raise
878 if RoundupService: 878 if RoundupService:
879 short_options += 'c' 879 short_options += 'c'
880 try: 880 try:
881 (optlist, args) = config.getopt(sys.argv[1:], 881 (optlist, args) = config.getopt(sys.argv[1:],
882 short_options, ("help", "version", "save-config",)) 882 short_options, ("help", "version", "save-config",))
883 except (getopt.GetoptError, configuration.ConfigurationError), e: 883 except (getopt.GetoptError, configuration.ConfigurationError) as e:
884 usage(str(e)) 884 usage(str(e))
885 return 885 return
886 886
887 # if running in windows service mode, don't do any other stuff 887 # if running in windows service mode, don't do any other stuff
888 if ("-c", "") in optlist: 888 if ("-c", "") in optlist:

Roundup Issue Tracker: http://roundup-tracker.org/