Fix `be import_xml` bugs.
authorNiall Douglas (s [underscore] sourceforge {at} nedprod [dot] com) <spam@spamtrap.com>
Sat, 3 Mar 2012 15:59:43 +0000 (10:59 -0500)
committerW. Trevor King <wking@drexel.edu>
Sat, 3 Mar 2012 15:59:43 +0000 (10:59 -0500)
libbe/bug.py
libbe/comment.py

index 3b9be59de7266fad73bc2e54f66d310c407e01e7..f562836602448c2593e4dd1560aa493072c41ef4 100644 (file)
@@ -410,8 +410,9 @@ class Bug (settings_object.SavedSettingsObject):
                     uuid = text
                     continue # don't set the bug's uuid tag.
                 elif child.tag == 'created':
-                    self.time = utility.str_to_time(text)
-                    self.explicit_attrs.append('time')
+                    if text is not settings_object.EMPTY:
+                        self.time = utility.str_to_time(text)
+                        self.explicit_attrs.append('time')
                     continue
                 elif child.tag == 'extra-string':
                     estrs.append(text)
index 082a46f70ce28abca893182342265e150b746313..cfb951d6a9992d1751f129d1afef6e58fd18960b 100644 (file)
@@ -377,7 +377,10 @@ class Comment (Tree, settings_object.SavedSettingsObject):
                     text = settings_object.EMPTY
                 else:
                     text = xml.sax.saxutils.unescape(child.text)
-                    text = text.decode('unicode_escape').strip()
+                    # Sometimes saxutils returns unicode
+                    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 comment's uuid tag.