Use except x as y instead of except x, y

According to https://docs.python.org/3/howto/pyporting.html the
syntax changed in Python 3.x. The new syntax is usable with
Python >= 2.6 and should be preferred to be compatible with Python3.

Enabled hacking check H231.

Change-Id: Ibe19ac61334d8708e3b8240e714ff98471b58111
This commit is contained in:
Christian Berendt 2014-05-30 00:10:47 +02:00
parent cb510440ff
commit b5f1db6cd6
3 changed files with 7 additions and 6 deletions

View File

@ -760,7 +760,7 @@ class BaseClientServer(object):
self.connections_condition.release()
try:
self._pollLoop()
except socket.error, e:
except socket.error as e:
if e.errno == errno.ECONNRESET:
self.log.debug("Connection reset by peer")
# This will get logged later at info level as
@ -2503,7 +2503,7 @@ class Server(BaseClientServer):
else:
request.connection.sendRaw(b'ERR UNKNOWN_ACL_VERB\n')
return
except ACLError, e:
except ACLError as e:
self.log.info("Error in grant command: %s" % (e.message,))
request.connection.sendRaw(b'ERR UNABLE %s\n' % (e.message,))
return
@ -2537,7 +2537,7 @@ class Server(BaseClientServer):
else:
request.connection.sendRaw(b'ERR UNKNOWN_ACL_VERB\n')
return
except ACLError, e:
except ACLError as e:
self.log.info("Error in revoke command: %s" % (e.message,))
request.connection.sendRaw(b'ERR UNABLE %s\n' % (e.message,))
return
@ -2567,7 +2567,7 @@ class Server(BaseClientServer):
else:
request.connection.sendRaw(b'ERR UNKNOWN_ACL_VERB\n')
return
except ACLError, e:
except ACLError as e:
self.log.info("Error in self-revoke command: %s" % (e.message,))
request.connection.sendRaw(b'ERR UNABLE %s\n' % (e.message,))
return

View File

@ -95,7 +95,7 @@ class ACLEntry(object):
if register:
try:
self._register = re.compile(register)
except re.error, e:
except re.error as e:
raise ACLError('Regular expression error: %s' % (e.message,))
else:
self._register = None
@ -110,7 +110,7 @@ class ACLEntry(object):
if invoke:
try:
self._invoke = re.compile(invoke)
except re.error, e:
except re.error as e:
raise ACLError('Regular expression error: %s' % (e.message,))
else:
self._invoke = None

View File

@ -32,6 +32,7 @@ exclude = .venv,.tox,dist,doc,*.egg
show-source = true
# E123, E125, and H ignored intentionally in this code-base
ignore = E123,E125,H
select = H231
[testenv:doc]
commands = python setup.py build_sphinx