Apply Niall's earlier fix for comment XML loading to bug XML loading.
authorW. Trevor King <wking@drexel.edu>
Sat, 3 Mar 2012 16:22:08 +0000 (11:22 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 3 Mar 2012 16:22:08 +0000 (11:22 -0500)
Sometimes saxutils returns unicode.

libbe/bug.py
libbe/comment.py

index f562836602448c2593e4dd1560aa493072c41ef4..7cf1bf86efce525247b2909d7d699d081d41f556 100644 (file)
@@ -405,7 +405,9 @@ class Bug (settings_object.SavedSettingsObject):
                     text = settings_object.EMPTY
                 else:
                     text = xml.sax.saxutils.unescape(child.text)
-                    text = text.decode('unicode_escape').strip()
+                    if not isinstance(text, unicode):
+                        text = text.decode('unicode_escape')
+                    text = text.strip()
                 if child.tag == 'uuid' and not preserve_uuids:
                     uuid = text
                     continue # don't set the bug's uuid tag.
index cfb951d6a9992d1751f129d1afef6e58fd18960b..392e692832cc6eac9c69749e2589399ce6ba4358 100644 (file)
@@ -377,7 +377,6 @@ class Comment (Tree, settings_object.SavedSettingsObject):
                     text = settings_object.EMPTY
                 else:
                     text = xml.sax.saxutils.unescape(child.text)
-                    # Sometimes saxutils returns unicode
                     if not isinstance(text, unicode):
                         text = text.decode('unicode_escape')
                     text = text.strip()