[Freeipa-devel] [PATCH] 0072 Internationalization for public errors

Petr Viktorin pviktori at redhat.com
Mon Sep 3 15:14:12 UTC 2012


On 08/29/2012 03:45 PM, Martin Kosek wrote:
> On 08/21/2012 03:31 PM, Petr Viktorin wrote:
>> On 07/25/2012 09:58 AM, Petr Viktorin wrote:
>>> I spent some time while IPA was installing tracking down error mesages
>>> that weren't marked for translation :)
>>> I also changed the error docstrings, as people are likely to look there
>>> for inspiration.
>>>
>>>
>>> https://fedorahosted.org/freeipa/ticket/1953
>>
>> Attaching rebased patch.
>>
>
> The changes looks OK, good job there. I just found 2 issues:
>
> 1) 2 unit tests got broken:
>
> ======================================================================
> FAIL: test_service[1]: service_mod: Try to update non-existent
> u'HTTP/testhost1.idm.lab.bos.redhat.com at IDM.LAB.BOS.REDHAT.COM'
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
>      self.test(*self.arg)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 249, in
> <lambda>
>      func = lambda: self.check(nice, **test)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 262, in check
>      self.check_exception(nice, cmd, args, options, expected)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 288, in
> check_exception
>      assert_deepequal(expected.strerror, e.strerror)
>    File "/root/freeipa-master/tests/util.py", line 343, in assert_deepequal
>      VALUE % (doc, expected, got, stack)
> AssertionError: assert_deepequal: expected != got.
>
>    expected = u'HTTP/testhost1.idm.lab.bos.redhat.com at IDM.LAB.BOS.REDHAT.COM:
> service not found'
>    got = u'no such entry'
>    path = ()
>
> ======================================================================
> FAIL: test_service[23]: service_mod: Try to update non-existent
> u'HTTP/testhost1.idm.lab.bos.redhat.com at IDM.LAB.BOS.REDHAT.COM'
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>    File "/usr/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
>      self.test(*self.arg)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 249, in
> <lambda>
>      func = lambda: self.check(nice, **test)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 262, in check
>      self.check_exception(nice, cmd, args, options, expected)
>    File "/root/freeipa-master/tests/test_xmlrpc/xmlrpc_test.py", line 288, in
> check_exception
>      assert_deepequal(expected.strerror, e.strerror)
>    File "/root/freeipa-master/tests/util.py", line 343, in assert_deepequal
>      VALUE % (doc, expected, got, stack)
> AssertionError: assert_deepequal: expected != got.
>
>    expected = u'HTTP/testhost1.idm.lab.bos.redhat.com at IDM.LAB.BOS.REDHAT.COM:
> service not found'
>    got = u'no such entry'
>    path = ()
>
> ----------------------------------------------------------------------
>
> You would have the properly catch and process exception in service_mod plugin
> in the following line:
>                  (dn, entry_attrs_old) = ldap.get_entry(dn, ['usercertificate'])
> to be able to update tests like that.
>
>
> 2) While at internationalizing public errors, we could fix the following
> exceptions in bindinstance.py. They are not supposed to be i18n-ed, nor they
> are correct and will crash horribly.
>
> @@ -277,7 +278,7 @@ def add_zone(name, zonemgr=None, dns_backup=None,
> ns_hostname=None, ns_ip_addres
>           # automatically retrieve list of DNS masters
>           dns_masters = api.Object.dnsrecord.get_dns_masters()
>           if not dns_masters:
> -            raise errors.NotFound("No IPA server with DNS support found!")
> +            raise errors.NotFound(_("No IPA server with DNS support found!"))
>           ns_main = dns_masters.pop(0)
>           ns_replicas = dns_masters
>           addresses = resolve_host(ns_main)
> @@ -321,7 +322,7 @@ def add_reverse_zone(zone, ns_hostname=None,
> ns_ip_address=None,
>           # automatically retrieve list of DNS masters
>           dns_masters = api.Object.dnsrecord.get_dns_masters()
>           if not dns_masters:
> -            raise errors.NotFound("No IPA server with DNS support found!")
> +            raise errors.NotFound(_("No IPA server with DNS support found!"))
>           ns_main = dns_masters.pop(0)
>           ns_replicas = dns_masters
>           addresses = resolve_host(ns_main)
>
>
>
> Martin
>

Thank you for the review.
Made service plugin use handle_not_found, and replaced NotFound in 
installer code with ScriptError.


-- 
Petr³
-------------- next part --------------
A non-text attachment was scrubbed...
Name: freeipa-pviktori-0072-03-Internationalization-for-public-errors.patch
Type: text/x-patch
Size: 53239 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20120903/9e74d767/attachment.bin>


More information about the Freeipa-devel mailing list