When MaxArgumentError si raised, the string localized by ngettext
is not printed properly.

https://fedorahosted.org/freeipa/ticket/1148

>From 4d05729e2994167a6c5b80c83b5e908929c04988 Mon Sep 17 00:00:00 2001
From: Martin Kosek <mko...@redhat.com>
Date: Tue, 31 May 2011 09:39:10 +0200
Subject: [PATCH] Localization fails for MaxArgumentError

When MaxArgumentError si raised, the string localized by ngettext
is not printed properly.

https://fedorahosted.org/freeipa/ticket/1148
---
 ipalib/errors.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/ipalib/errors.py b/ipalib/errors.py
index 53554b77e76b34009ad0d1645ecb6bc2468e47ea..55bb8a38b55982ef74a479777ef90998b3116094 100644
--- a/ipalib/errors.py
+++ b/ipalib/errors.py
@@ -263,7 +263,10 @@ class PublicError(StandardError):
                 self.format = format
             self.forwarded = False
             self.msg = self.format % kw
-            self.strerror = ugettext(self.format) % kw
+            if isinstance(self.format, basestring):
+                self.strerror = ugettext(self.format) % kw
+            else:
+                self.strerror = self.format % kw
         else:
             if type(message) is not unicode:
                 raise TypeError(
-- 
1.7.5.2

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to