Author: dmeyer
Date: Mon Feb 13 20:48:11 2006
New Revision: 1181

Modified:
   trunk/base/src/base/libxml2.py

Log:
fix unicode bug

Modified: trunk/base/src/base/libxml2.py
==============================================================================
--- trunk/base/src/base/libxml2.py      (original)
+++ trunk/base/src/base/libxml2.py      Mon Feb 13 20:48:11 2006
@@ -211,6 +211,10 @@
                 raise TreeError('xmlAddChild() failed')
             return Node(_obj=ret)
 
+        if isinstance(content, unicode):
+            content = content.encode('utf-8')
+        if content and not isinstance(content, str):
+            content = str(content)
         ret = libxml2mod.xmlNewChild(self._o, None, name_or_child, content)
         if ret is None:
             raise TreeError('xmlNewChild() failed')
@@ -275,6 +279,9 @@
         if self._doc:
             # this is not real doc, it is the root node
             return libxml2mod.xmlSaveFormatFile(filename, self._doc._o, 1)
+        # delete old file (just in case)
+        if os.path.isfile(filename):
+            os.unlink(filename)
         return libxml2mod.xmlSaveFormatFile(filename, self._o, 1)
 
 


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to