Don't save non-string portions of *.info in playlist xml files
authorW. Trevor King <wking@drexel.edu>
Tue, 3 Aug 2010 00:50:55 +0000 (20:50 -0400)
committerW. Trevor King <wking@drexel.edu>
Tue, 3 Aug 2010 00:50:55 +0000 (20:50 -0400)
hooke/playlist.py
hooke/ui/gui/__init__.py

index c57604ff08872fd8f9ab3aef584551947eac191c..d39938d845a73b01a24cf47687ce9bb64cd3c142 100644 (file)
@@ -24,6 +24,7 @@
 import copy
 import hashlib
 import os.path
+import types
 import xml.dom.minidom
 
 from . import curve as curve
@@ -231,6 +232,9 @@ class FilePlaylist (Playlist):
         root.setAttribute('version', self.version) # store playlist version
         root.setAttribute('index', str(self._index))
         for key,value in self.info.items(): # save info variables
+            if (key in self._ignored_keys
+                or not isinstance(value, types.StringTypes)):
+                continue
             root.setAttribute(self._clean_key(key), str(value))
         for curve in self: # save curves and their attributes
             curve_element = doc.createElement('curve')
@@ -244,7 +248,8 @@ class FilePlaylist (Playlist):
                             os.path.expanduser(self.path))))
             curve_element.setAttribute('path', path)
             for key,value in curve.info.items():
-                if key in self._ignored_keys:
+                if (key in self._ignored_keys
+                    or not isinstance(value, types.StringTypes)):
                     continue
                 curve_element.setAttribute(self._clean_key(key), str(value))
         string = doc.toprettyxml(encoding='utf-8')
index 9059b8c85088c1d3b8390c99ad068b2f01d365df..c3a9f45a94c3314109b5b43c7609bdbca6cbcb2b 100644 (file)
@@ -416,7 +416,6 @@ class HookeFrame (wx.Frame):
         else:
             raise NotImplementedError()
         if 'note' in self._c:
-            print sorted(curve.info.keys())
             self._c['note'].set_text(curve.info['note'])
         if 'playlist' in self._c:
             self._c['playlist']._c['tree'].set_selected_curve(