Changeset 1489
- Timestamp:
- 10/13/09 13:11:07 (6 weeks ago)
- Hashname:
- 20091013111107-85ee7-b139ccfa17bfd6abfd2d9121e58848e5d8b4a83b
- Files:
-
- 1 modified
-
deejayd/xmlobject.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
deejayd/xmlobject.py
r1310 r1489 26 26 class DeejaydXMLObject(object): 27 27 28 def __is_xml_char(self, char): 29 # FIXME: This function should probably be more complicated than this. 30 return char not in '\x19' 31 28 32 def _to_xml_string(self, s): 33 xml_string = '' 29 34 if isinstance(s, int) or isinstance(s, float) or isinstance(s, long): 30 return"%d" % (s,)35 xml_string = "%d" % (s,) 31 36 elif isinstance(s, str): 32 return"%s" % (s.decode('utf-8'))37 xml_string = "%s" % (s.decode('utf-8')) 33 38 elif isinstance(s, unicode): 34 39 rs = s.encode("utf-8") 35 return"%s" % (rs.decode('utf-8'))40 xml_string = "%s" % (rs.decode('utf-8')) 36 41 else: 37 42 raise TypeError 43 44 filtered_xml_string = [] 45 for string_char in xml_string: 46 if self.__is_xml_char(string_char): 47 filtered_xml_string.append(string_char) 48 return ''.join(filtered_xml_string) 38 49 39 50 def _indent(self,elem, level=0):
