[master/f18-branch] [PATCH] Fix getting country layout variants

Vratislav Podzimek vpodzime at redhat.com
Thu Dec 6 12:55:35 UTC 2012


Commit 70e339b86b0d4a000e0e62253703ac4ca8618b74 introduced the bug
resulting in almost empty dictionary of country layout variants.
Iteration over countries uses the same _get_variant method as iteration
over languages, but comes afterwards. The check added in
70e339b86b0d4a000e0e62253703ac4ca8618b74 fails for almost every layout
that is processed in iteration over countries.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 pyanaconda/keyboard.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/keyboard.py b/pyanaconda/keyboard.py
index 828c709..7c00340 100755
--- a/pyanaconda/keyboard.py
+++ b/pyanaconda/keyboard.py
@@ -356,7 +356,7 @@ class XklWrapper(object):
         #'grp' means that we want layout (group) switching options
         self.configreg.foreach_option('grp', self._get_switch_option, None)
 
-    def _get_variant(self, c_reg, item, subitem, dest):
+    def _get_variant(self, c_reg, item, subitem, lang):
         if subitem:
             name = item_str(item.name) + " (" + item_str(subitem.name) + ")"
             description = item_str(subitem.description)
@@ -366,11 +366,13 @@ class XklWrapper(object):
 
         #if this layout has already been added for some other language,
         #do not add it again (would result in duplicates in our lists)
-        if name not in self.name_to_show_str:
-            if dest:
-                self.name_to_show_str[name] = "%s (%s)" % (dest.encode("utf-8"),
+        if lang and name not in self.name_to_show_str:
+            self.name_to_show_str[name] = "%s (%s)" % (lang.encode("utf-8"),
                                                     description.encode("utf-8"))
-
+            self._variants_list.append(_Layout(name, description))
+        else:
+            #if lang is None, we are iterating over countries not languages
+            #and should just append the layout to the list
             self._variants_list.append(_Layout(name, description))
 
     def _get_language_variants(self, c_reg, item, user_data=None):
-- 
1.7.11.7



More information about the anaconda-patches mailing list