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/permission.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'ipalib/plugins/permission.py') diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py index 75b21091..80c6bc06 100644 --- a/ipalib/plugins/permission.py +++ b/ipalib/plugins/permission.py @@ -303,7 +303,8 @@ class permission_del(LDAPDelete): def pre_callback(self, ldap, dn, *keys, **options): assert isinstance(dn, DN) if not options.get('force') and not self.obj.check_system(ldap, dn, *keys): - raise errors.ACIError(info='A SYSTEM permission may not be removed') + raise errors.ACIError( + info=_('A SYSTEM permission may not be removed')) # remove permission even when the underlying ACI is missing try: self.api.Command.aci_del(keys[-1], aciprefix=ACI_PREFIX) @@ -323,7 +324,8 @@ class permission_mod(LDAPUpdate): def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options): assert isinstance(dn, DN) if not self.obj.check_system(ldap, dn, *keys): - raise errors.ACIError(info='A SYSTEM permission may not be modified') + raise errors.ACIError( + info=_('A SYSTEM permission may not be modified')) # check if permission is in LDAP try: @@ -350,7 +352,7 @@ class permission_mod(LDAPUpdate): pass # permission may be renamed, continue else: raise errors.ValidationError( - name='rename',error=_('New name can not be empty')) + name='rename', error=_('New name can not be empty')) opts = self.obj.filter_aci_attributes(options) setattr(context, 'aciupdate', False) -- cgit