From 50627004b83fe155767fb02b51099eba612a5855 Mon Sep 17 00:00:00 2001 From: Tomas Babej Date: Fri, 8 Jan 2016 18:23:35 +0100 Subject: py3: Remove py3 incompatible exception handling https://fedorahosted.org/freeipa/ticket/5585 Reviewed-By: Martin Babinsky --- doc/guide/guide.org | 4 ++-- doc/guide/wsgi.py.txt | 2 +- ipaserver/install/server/common.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/guide/guide.org b/doc/guide/guide.org index 55c172535..6d181559f 100644 --- a/doc/guide/guide.org +++ b/doc/guide/guide.org @@ -752,9 +752,9 @@ def run(api): except KeyboardInterrupt: print '' api.log.info('operation aborted') - except PublicError, e: + except PublicError as e: error = e - except Exception, e: + except Exception as e: api.log.exception('%s: %s', e.__class__.__name__, str(e)) error = InternalError() if error is not None: diff --git a/doc/guide/wsgi.py.txt b/doc/guide/wsgi.py.txt index eb64f3a82..8566a25a1 100644 --- a/doc/guide/wsgi.py.txt +++ b/doc/guide/wsgi.py.txt @@ -13,7 +13,7 @@ env._finalize_core(**dict(DEFAULT_CONFIG)) api.bootstrap(context='server', debug=env.debug, log=None) (ref:wsgi-app-bootstrap) try: api.finalize() (ref:wsgi-app-finalize) -except Exception, e: +except Exception as e: api.log.error('Failed to start IPA: %s' % e) else: api.log.info('*** PROCESS START ***') diff --git a/ipaserver/install/server/common.py b/ipaserver/install/server/common.py index 637e56643..08980c60f 100644 --- a/ipaserver/install/server/common.py +++ b/ipaserver/install/server/common.py @@ -138,7 +138,7 @@ class BaseServerCA(common.Installable, core.Group, core.Composite): for rdn in dn: if rdn.attr.lower() not in VALID_SUBJECT_ATTRS: raise ValueError("invalid attribute: \"%s\"" % rdn.attr) - except ValueError, e: + except ValueError as e: raise ValueError("invalid subject base format: %s" % e) ca_signing_algorithm = Knob( @@ -243,7 +243,7 @@ class BaseServerDNS(common.Installable, core.Group, core.Composite): encoding = 'utf-8' value = value.decode(encoding) bindinstance.validate_zonemgr_str(value) - except ValueError, e: + except ValueError as e: # FIXME we can do this in better way # https://fedorahosted.org/freeipa/ticket/4804 # decode to proper stderr encoding -- cgit