← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/unicode-config into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/unicode-config into lp:openlp.

Requested reviews:
  Raoul Snyman (raoul-snyman)


Fixes unicode for both section and key names and values also.
-- 
https://code.launchpad.net/~mahfiaz/openlp/unicode-config/+merge/23420
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/lib/pluginconfig.py'
--- openlp/core/lib/pluginconfig.py	2010-03-21 23:58:01 +0000
+++ openlp/core/lib/pluginconfig.py	2010-04-14 18:55:30 +0000
@@ -139,8 +139,9 @@
         list = []
         if list_count > 0:
             for counter in range(0, list_count):
-                item = unicode(self.get_config(u'%s %d' % (name, counter)))
-                list.append(item)
+                item = self.get_config(u'%s %d' % (name, counter))
+                if item:
+                    list.append(item)
         return list
 
     def set_list(self, name, list):

=== modified file 'openlp/core/utils/registry.py'
--- openlp/core/utils/registry.py	2010-03-21 23:58:01 +0000
+++ openlp/core/utils/registry.py	2010-04-14 18:55:30 +0000
@@ -41,15 +41,17 @@
         """
         Check if a value exists.
         """
-        return self.config.has_option(section, key)
+        return self.config.has_option(section.encode('utf-8'), 
+            key.encode('utf-8'))
 
     def get_value(self, section, key, default=None):
         """
         Get a single value from the registry.
         """
         try:
-            if self.config.get(section, key):
-                return self.config.get(section, key)
+            if self.config.get(section.encode('utf-8'), key.encode('utf-8')):
+                return self.config.get(section.encode('utf-8'), 
+                    key.encode('utf-8')).decode('utf-8')
             else:
                 return default
         except:
@@ -60,7 +62,8 @@
         Set a single value in the registry.
         """
         try :
-            self.config.set(section, key, unicode(value))
+            self.config.set(section.encode('utf-8'), key.encode('utf-8'), 
+                unicode(value).encode('utf-8'))
             return self._save()
         except:
             return False
@@ -70,7 +73,8 @@
         Delete a single value from the registry.
         """
         try:
-            self.config.remove_option(section, key)
+            self.config.remove_option(section.encode('utf-8'), 
+                key.encode('utf-8'))
             return self._save()
         except:
             return False
@@ -79,14 +83,14 @@
         """
         Check if a section exists.
         """
-        return self.config.has_section(section)
+        return self.config.has_section(section.encode('utf-8'))
 
     def create_section(self, section):
         """
         Create a new section in the registry.
         """
         try:
-            self.config.add_section(section)
+            self.config.add_section(section.encode('utf-8'))
             return self._save()
         except:
             return False
@@ -96,7 +100,7 @@
         Delete a section (including all values).
         """
         try:
-            self.config.remove_section(section)
+            self.config.remove_section(section.encode('utf-8'))
             return self._save()
         except:
             return False


Follow ups