← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/unicode_warning_fix into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/unicode_warning_fix into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/unicode_warning_fix/+merge/84681

Ensure that action category names are unicode, to prevent warnings on comparison.
-- 
https://code.launchpad.net/~mahfiaz/openlp/unicode_warning_fix/+merge/84681
Your team OpenLP Core is requested to review the proposed merge of lp:~mahfiaz/openlp/unicode_warning_fix into lp:openlp.
=== modified file 'openlp/core/utils/actions.py'
--- openlp/core/utils/actions.py	2011-12-06 19:25:12 +0000
+++ openlp/core/utils/actions.py	2011-12-06 21:30:29 +0000
@@ -149,6 +149,8 @@
         return self.__next__()
 
     def has_key(self, key):
+        if key != None and not isinstance(key, unicode):
+            key = unicode(key)
         for category in self.categories:
             if category.name == key:
                 return True
@@ -164,6 +166,8 @@
             self.add(name, weight)
 
     def add(self, name, weight=0, actions=None):
+        if name != None and not isinstance(name, unicode):
+            name = unicode(name)
         category = ActionCategory(name, weight)
         if actions:
             for action in actions:
@@ -270,6 +274,8 @@
         ``weight``
             The category's weight (int).
         """
+        if name != None and not isinstance(name, unicode):
+            name = unicode(name)
         if name in self.categories:
             # Only change the weight and resort the categories again.
             for category in self.categories:


Follow ups