From: W. Trevor King Date: Sat, 3 Mar 2012 16:22:08 +0000 (-0500) Subject: Apply Niall's earlier fix for comment XML loading to bug XML loading. X-Git-Tag: 1.1.0~148 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9425f381b58d878194e7d19629192ecb6bd948c8;p=be.git Apply Niall's earlier fix for comment XML loading to bug XML loading. Sometimes saxutils returns unicode. --- diff --git a/libbe/bug.py b/libbe/bug.py index f562836..7cf1bf8 100644 --- a/libbe/bug.py +++ b/libbe/bug.py @@ -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. diff --git a/libbe/comment.py b/libbe/comment.py index cfb951d..392e692 100644 --- a/libbe/comment.py +++ b/libbe/comment.py @@ -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()