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
This commit is contained in:
Petr Viktorin authored and Martin Kosek committed 2012-09-03 18:16:12 +02:00
1 parent 4f03aed5e6
commit a95eaeac8e
30 files changed
+175 -123

No files matched your search

+9 -5
View File
@@ -17,15 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
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