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/automount.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ipalib/plugins/automount.py') diff --git a/ipalib/plugins/automount.py b/ipalib/plugins/automount.py index 8e9eb5745..19b60905d 100644 --- a/ipalib/plugins/automount.py +++ b/ipalib/plugins/automount.py @@ -440,7 +440,9 @@ class automountlocation_import(LDAPQuery): result['duplicatekeys'].append(am[0]) pass else: - raise errors.DuplicateEntry(message=unicode('key %(key)s already exists' % {'key':am[0]})) + raise errors.DuplicateEntry( + message=_('key %(key)s already exists') % dict( + key=am[0])) # Add the new map if not am[1].startswith('-'): try: @@ -454,7 +456,9 @@ class automountlocation_import(LDAPQuery): result['duplicatemaps'].append(am[0]) pass else: - raise errors.DuplicateEntry(message=unicode('map %(map)s already exists' % {'map':am[1]})) + raise errors.DuplicateEntry( + message=_('map %(map)s already exists') % dict( + map=am[1])) except errors.DuplicateEntry: # This means the same map is used on several mount points. pass -- cgit