URL: https://github.com/freeipa/freeipa/pull/539 Author: frasertweedale Title: #539: Define errors_by_code in ipalib.errors Action: opened
PR body: """ The errors_by_code mapping will soon be used in more places, as part of the Dogtag GSS-API authentication work. Move its definition to ipalib.errors. Part of: https://pagure.io/freeipa/issue/5011 """ To pull the PR as Git branch: git remote add ghfreeipa https://github.com/freeipa/freeipa git fetch ghfreeipa pull/539/head:pr539 git checkout pr539
From b7733bd1b1ad5bd7ddecedf37df6edd68edcdf22 Mon Sep 17 00:00:00 2001 From: Fraser Tweedale <ftwee...@redhat.com> Date: Mon, 6 Mar 2017 12:03:44 +1000 Subject: [PATCH] Define errors_by_code in ipalib.errors The errors_by_code mapping will soon be used in more places, as part of the Dogtag GSS-API authentication work. Move its definition to ipalib.errors. Part of: https://pagure.io/freeipa/issue/5011 --- ipalib/errors.py | 2 ++ ipalib/rpc.py | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ipalib/errors.py b/ipalib/errors.py index 6aaca70..a17eda4 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -1995,5 +1995,7 @@ class GenericError(PublicError): public_errors = tuple(sorted( messages.iter_messages(globals(), PublicError), key=lambda E: E.errno)) +errors_by_code = dict((e.errno, e) for e in public_errors) + if __name__ == '__main__': messages.print_report('public errors', public_errors) diff --git a/ipalib/rpc.py b/ipalib/rpc.py index f2cdad9..d77b52d 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -50,7 +50,7 @@ from ipalib.backend import Connectible from ipalib.constants import LDAP_GENERALIZED_TIME_FORMAT -from ipalib.errors import (public_errors, UnknownError, NetworkError, +from ipalib.errors import (errors_by_code, UnknownError, NetworkError, KerberosError, XMLRPCMarshallError, JSONError) from ipalib import errors, capabilities from ipalib.request import context, Connection @@ -86,8 +86,6 @@ COOKIE_NAME = 'ipa_session' KEYRING_COOKIE_NAME = '%s_cookie:%%s' % COOKIE_NAME -errors_by_code = dict((e.errno, e) for e in public_errors) - def client_session_keyring_keyname(principal): '''
-- Manage your subscription for the Freeipa-devel mailing list: https://www.redhat.com/mailman/listinfo/freeipa-devel Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code