Define errors_by_code in ipalib.errors

The errors_by_code mapping could be used in more places.  In
particular it will be useful in the Dogtag GSS-API authentication
effort.  Move to ipalib.errors.

Part of: https://pagure.io/freeipa/issue/5011

Reviewed-By: Christian Heimes <cheimes@redhat.com>
This commit is contained in:
Fraser Tweedale
2017-03-06 12:03:44 +10:00
parent cc624fb178
commit c7766ebb94
2 changed files with 3 additions and 3 deletions

View File

@@ -2016,5 +2016,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)