diff options
author | Petr Viktorin <pviktori@redhat.com> | 2012-07-04 08:52:47 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2012-09-03 18:16:12 +0200 |
commit | a95eaeac8e07b8ccd173b0f408575cc9a0d508fc (patch) | |
tree | 6cd7e09e02d313a3d382d1efbb27588aab27a866 /ipalib/plugins/virtual.py | |
parent | 4f03aed5e603389bbb149464eee597180470ad70 (diff) | |
download | freeipa-a95eaeac8e07b8ccd173b0f408575cc9a0d508fc.tar.gz freeipa-a95eaeac8e07b8ccd173b0f408575cc9a0d508fc.tar.xz freeipa-a95eaeac8e07b8ccd173b0f408575cc9a0d508fc.zip |
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
Diffstat (limited to 'ipalib/plugins/virtual.py')
-rw-r--r-- | ipalib/plugins/virtual.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ipalib/plugins/virtual.py b/ipalib/plugins/virtual.py index 8db1a9653..414de4c00 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 |