From a95eaeac8e07b8ccd173b0f408575cc9a0d508fc Mon Sep 17 00:00:00 2001 From: Petr Viktorin Date: Wed, 4 Jul 2012 08:52:47 -0400 Subject: Internationalization for public errors Currently, we throw many public exceptions without proper i18n. Wrap natural-language error messages in _() so they can be translated. In the service plugin, raise NotFound errors using handle_not_found helper so the error message contains the offending service. Use ScriptError instead of NotFoundError in bindinstance install. https://fedorahosted.org/freeipa/ticket/1953 --- ipapython/dogtag.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'ipapython') diff --git a/ipapython/dogtag.py b/ipapython/dogtag.py index df569c44..8298ecfe 100644 --- a/ipapython/dogtag.py +++ b/ipapython/dogtag.py @@ -17,15 +17,17 @@ # along with this program. If not, see . # -from ipalib import api, errors import httplib import xml.dom.minidom -from ipapython import nsslib, ipautil import nss.nss as nss from nss.error import NSPRError -from ipalib.errors import NetworkError, CertificateOperationError from urllib import urlencode + +from ipalib import api, errors +from ipapython import nsslib, ipautil +from ipalib.errors import NetworkError, CertificateOperationError from ipapython.ipa_log_manager import * +from ipalib.text import _ def get_ca_certchain(ca_host=None): """ @@ -52,12 +54,14 @@ def get_ca_certchain(ca_host=None): reason = item_node[0].childNodes[0].data raise errors.RemoteRetrieveError(reason=reason) except Exception, e: - raise errors.RemoteRetrieveError(reason="Retrieving CA cert chain failed: %s" % str(e)) + raise errors.RemoteRetrieveError( + reason=_("Retrieving CA cert chain failed: %s") % e) finally: if doc: doc.unlink() else: - raise errors.RemoteRetrieveError(reason="request failed with HTTP status %d" % res.status) + raise errors.RemoteRetrieveError( + reason=_("request failed with HTTP status %d") % res.status) return chain -- cgit