diff options
author | Robert Kuska <rkuska@redhat.com> | 2015-08-24 12:40:33 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-09-30 10:51:36 +0200 |
commit | 01da4a8de3ed8651cc95df6125751e1603dbd14e (patch) | |
tree | 823856bad461808163b3fc05c54e0d87d26dd381 /ipalib | |
parent | 34e6c3ea05b23f4a5fe6fb6aaadd394967f31340 (diff) | |
download | freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.tar.gz freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.tar.xz freeipa-01da4a8de3ed8651cc95df6125751e1603dbd14e.zip |
Replace StandardError with Exception
StandardError was removed in Python3 and instead
Exception should be used.
Signed-off-by: Robert Kuska <rkuska@redhat.com>
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib')
-rw-r--r-- | ipalib/backend.py | 6 | ||||
-rw-r--r-- | ipalib/cli.py | 2 | ||||
-rw-r--r-- | ipalib/config.py | 4 | ||||
-rw-r--r-- | ipalib/constants.py | 2 | ||||
-rw-r--r-- | ipalib/errors.py | 6 | ||||
-rw-r--r-- | ipalib/parameters.py | 6 | ||||
-rw-r--r-- | ipalib/plugable.py | 4 | ||||
-rw-r--r-- | ipalib/plugins/migration.py | 4 |
8 files changed, 17 insertions, 17 deletions
diff --git a/ipalib/backend.py b/ipalib/backend.py index 288a0edf2..b8fa29626 100644 --- a/ipalib/backend.py +++ b/ipalib/backend.py @@ -56,7 +56,7 @@ class Connectible(Backend): Create thread-local connection. """ if hasattr(context, self.id): - raise StandardError( + raise Exception( "connect: 'context.%s' already exists in thread %r" % ( self.id, threading.currentThread().getName() ) @@ -71,7 +71,7 @@ class Connectible(Backend): def disconnect(self): if not hasattr(context, self.id): - raise StandardError( + raise Exception( "disconnect: 'context.%s' does not exist in thread %r" % ( self.id, threading.currentThread().getName() ) @@ -130,7 +130,7 @@ class Executioner(Backend): result = self.Command[_name](*args, **options) except PublicError as e: error = e - except StandardError as e: + except Exception as e: self.exception( 'non-public: %s: %s', e.__class__.__name__, str(e) ) diff --git a/ipalib/cli.py b/ipalib/cli.py index b0e138925..44ef61d30 100644 --- a/ipalib/cli.py +++ b/ipalib/cli.py @@ -1350,7 +1350,7 @@ def run(api): api.log.info('operation aborted') except PublicError as e: error = e - except StandardError as 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/ipalib/config.py b/ipalib/config.py index 14368e2b4..eb823d851 100644 --- a/ipalib/config.py +++ b/ipalib/config.py @@ -210,7 +210,7 @@ class Env(object): Prevent further changes to environment. """ if self.__locked is True: - raise StandardError( + raise Exception( '%s.__lock__() already called' % self.__class__.__name__ ) object.__setattr__(self, '_Env__locked', True) @@ -407,7 +407,7 @@ class Env(object): def __doing(self, name): if name in self.__done: - raise StandardError( + raise Exception( '%s.%s() already called' % (self.__class__.__name__, name) ) self.__done.add(name) diff --git a/ipalib/constants.py b/ipalib/constants.py index 53c3106cd..987d40901 100644 --- a/ipalib/constants.py +++ b/ipalib/constants.py @@ -49,7 +49,7 @@ TYPE_ERROR = '%s: need a %r; got %r (a %r)' # Stardard format for TypeError message when a callable is expected: CALLABLE_ERROR = '%s: need a callable; got %r (which is a %r)' -# Standard format for StandardError message when overriding an attribute: +# Standard format for Exception message when overriding an attribute: OVERRIDE_ERROR = 'cannot override %s.%s value %r with %r' # Standard format for AttributeError message when a read-only attribute is diff --git a/ipalib/errors.py b/ipalib/errors.py index 2f7c77c1c..49b628aad 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -107,7 +107,7 @@ from ipalib import messages from ipaplatform.paths import paths -class PrivateError(StandardError): +class PrivateError(Exception): """ Base class for exceptions that are *never* forwarded in an RPC response. """ @@ -122,7 +122,7 @@ class PrivateError(StandardError): self.__class__.__name__, key, value, ) setattr(self, key, value) - StandardError.__init__(self, self.msg) + Exception.__init__(self, self.msg) class SubprocessError(PrivateError): @@ -239,7 +239,7 @@ def _(message): return message -class PublicError(StandardError): +class PublicError(Exception): """ **900** Base class for exceptions that can be forwarded in an RPC response. """ diff --git a/ipalib/parameters.py b/ipalib/parameters.py index 176df09ea..dab235a24 100644 --- a/ipalib/parameters.py +++ b/ipalib/parameters.py @@ -242,7 +242,7 @@ class DefaultFrom(ReadOnly): return try: return self.callback(*vals) - except StandardError: + except Exception: pass def __json__(self): @@ -740,7 +740,7 @@ class Param(ReadOnly): return value try: return self.normalizer(value) - except StandardError: + except Exception: return value def convert(self, value): @@ -917,7 +917,7 @@ class Param(ReadOnly): if default is not None: try: return self.convert(self.normalize(default)) - except StandardError: + except Exception: pass return self.default diff --git a/ipalib/plugable.py b/ipalib/plugable.py index 2a608d8cb..2b593ec3b 100644 --- a/ipalib/plugable.py +++ b/ipalib/plugable.py @@ -360,7 +360,7 @@ class API(ReadOnly): def __doing(self, name): if name in self.__done: - raise StandardError( + raise Exception( '%s.%s() already called' % (self.__class__.__name__, name) ) self.__done.add(name) @@ -572,7 +572,7 @@ class API(ReadOnly): module = importlib.import_module(name) except errors.SkipPluginModule as e: self.log.debug("skipping plugin module %s: %s", name, e.reason) - except StandardError as e: + except Exception as e: if self.env.startup_traceback: import traceback self.log.error("could not load plugin module %s\n%s", name, diff --git a/ipalib/plugins/migration.py b/ipalib/plugins/migration.py index 3e3c0fe19..59c49fae5 100644 --- a/ipalib/plugins/migration.py +++ b/ipalib/plugins/migration.py @@ -31,7 +31,7 @@ from ipalib.plugins.user import NO_UPG_MAGIC if api.env.in_server and api.env.context in ['lite', 'server']: try: from ipaserver.plugins.ldap2 import ldap2 - except StandardError as e: + except Exception as e: raise e from ipalib import _ from ipapython.dn import DN @@ -922,7 +922,7 @@ can use their Kerberos accounts.''') ds_base_dn = DN(entries[0]['namingcontexts'][0]) assert isinstance(ds_base_dn, DN) except (IndexError, KeyError) as e: - raise StandardError(str(e)) + raise Exception(str(e)) # migrate! (migrated, failed) = self.migrate( |