New style exception arguments

pull/7/head
Ferry Boender 9 years ago
parent 3759575e8e
commit acb0333b0a
  1. 2
      src/formdefinition.py
  2. 6
      src/scriptform.py
  3. 4
      src/webserver.py

@ -84,7 +84,7 @@ class FormDefinition(object):
value = self._field_validate(field_name, form_values)
if value is not None:
values[field_name] = value
except ValidationError, err:
except ValidationError as err:
errors.setdefault(field_name, []).append(str(err))
return (errors, values)

@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Scriptform roughly works like this:
@ -234,14 +234,14 @@ def main(): # pragma: no cover
elif options.action_stop:
daemon.stop()
sys.exit(0)
except socket.error, err:
except socket.error as err:
log.exception(err)
sys.stderr.write("Cannot bind to port {}: {}\n".format(
options.port,
str(err)
))
sys.exit(2)
except Exception, err:
except Exception as err:
log.exception(err)
raise

@ -95,7 +95,7 @@ class RequestHandler(BaseHTTPRequestHandler):
else:
raise HTTPError(404, "Not found")
method_cb(**params)
except HTTPError, err:
except HTTPError as err:
# HTTP erors are generally thrown by the webapp on purpose. Send
# error to the browser.
if err.status_code not in (401, ):
@ -108,7 +108,7 @@ class RequestHandler(BaseHTTPRequestHandler):
err.msg))
self.wfile.flush()
return False
except Exception, err:
except Exception as err:
self.scriptform.log.exception(err)
self.send_error(500, "Internal server error")
raise

Loading…
Cancel
Save