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 --- ipalib/plugins/virtual.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ipalib/plugins/virtual.py') diff --git a/ipalib/plugins/virtual.py b/ipalib/plugins/virtual.py index 8db1a965..414de4c0 100644 --- a/ipalib/plugins/virtual.py +++ b/ipalib/plugins/virtual.py @@ -24,6 +24,7 @@ from ipalib import api from ipalib import Command from ipalib import errors from ipapython.dn import DN +from ipalib.text import _ class VirtualCommand(Command): """ @@ -48,7 +49,7 @@ class VirtualCommand(Command): This should be executed before any actual work is done. """ if self.operation is None and operation is None: - raise errors.ACIError(info='operation not defined') + raise errors.ACIError(info=_('operation not defined')) if operation is None: operation = self.operation @@ -60,8 +61,9 @@ class VirtualCommand(Command): try: if not ldap.can_write(operationdn, "objectclass"): - raise errors.ACIError(info='not allowed to perform this command') + raise errors.ACIError( + info=_('not allowed to perform this command')) except errors.NotFound: - raise errors.ACIError(info='No such virtual command') + raise errors.ACIError(info=_('No such virtual command')) return True -- cgit