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/selinuxusermap.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/selinuxusermap.py')
-rw-r--r-- | ipalib/plugins/selinuxusermap.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ipalib/plugins/selinuxusermap.py b/ipalib/plugins/selinuxusermap.py index d793987aa..13bbb58ec 100644 --- a/ipalib/plugins/selinuxusermap.py +++ b/ipalib/plugins/selinuxusermap.py @@ -283,9 +283,11 @@ class selinuxusermap_mod(LDAPUpdate): raise errors.MutuallyExclusiveError(reason=notboth_err) if is_all(options, 'usercategory') and 'memberuser' in entry_attrs: - raise errors.MutuallyExclusiveError(reason="user category cannot be set to 'all' while there are allowed users") + raise errors.MutuallyExclusiveError(reason=_("user category " + "cannot be set to 'all' while there are allowed users")) if is_all(options, 'hostcategory') and 'memberhost' in entry_attrs: - raise errors.MutuallyExclusiveError(reason="host category cannot be set to 'all' while there are allowed hosts") + raise errors.MutuallyExclusiveError(reason=_("host category " + "cannot be set to 'all' while there are allowed hosts")) if 'ipaselinuxuser' in entry_attrs: validate_selinuxuser_inlist(ldap, entry_attrs['ipaselinuxuser']) @@ -414,7 +416,8 @@ class selinuxusermap_add_user(LDAPAddMember): self.obj.handle_not_found(*keys) if 'usercategory' in entry_attrs and \ entry_attrs['usercategory'][0].lower() == 'all': - raise errors.MutuallyExclusiveError(reason="users cannot be added when user category='all'") + raise errors.MutuallyExclusiveError( + reason=_("users cannot be added when user category='all'")) if 'seealso' in entry_attrs: raise errors.MutuallyExclusiveError(reason=notboth_err) return dn @@ -445,7 +448,8 @@ class selinuxusermap_add_host(LDAPAddMember): self.obj.handle_not_found(*keys) if 'hostcategory' in entry_attrs and \ entry_attrs['hostcategory'][0].lower() == 'all': - raise errors.MutuallyExclusiveError(reason="hosts cannot be added when host category='all'") + raise errors.MutuallyExclusiveError( + reason=_("hosts cannot be added when host category='all'")) if 'seealso' in entry_attrs: raise errors.MutuallyExclusiveError(reason=notboth_err) return dn |