Unable to create new item; libxml2 fussyness in syncato 0.8 XMLFragment.py

<[email protected]> Sat, 13 Mar 2004 13:20:22 -0800
Newsgroups gmane.comp.web.syncato.general
Message-ID <000801c40941$080c8920$6907a8c0@bi5triy>
I get an error while attempting to create a new item. It appears to be due to a defaulted node.

Guarding the call to ParseDoc() by reversing that call with the test for node==None and instead calling newDoc() appears a
workaround.

At least until/unless I/we figure out what the root cause might be. (Or if it's related to why I still can't get Syncato working
with BerkeleyDBXML1.2.1 plus DB4.2.52 plus recompiled-and-actually-called-bsddb3-4.2.4.)


The error:
- TypeError: xmlParseDoc() argument 1 must be string without null bytes or None, not str
- Unable to convert Python Object to XPathxmlXPathCompiledEval: evaluation failed

Environment:
- Python2.3.1 (1?)
- libxml2-2.5.11
- Syncato from CVS (10Mar04; so-called 0.8)

My patch:
XMLFragment.py, v 1.1 2003/12/15 14:57:48
*** XMLFragment.py.~1.1.~	2003-12-15 06:57:48.000000000 -0800
--- XMLFragment.py	2004-03-13 11:46:26.000000000 -0800
***************
*** 25,32 ****
      def __init__(self, node = None):
          self.node = node
!         if (isinstance(node, str) or isinstance(node, unicode)):
!             self.node = libxml2.parseDoc(node)
!         elif (node == None):
              self.node = libxml2.newDoc("1.0")

          self._registerNamespaces()
--- 25,32 ----
      def __init__(self, node = None):
          self.node = node
!         if (node == None):
              self.node = libxml2.newDoc("1.0")
+         elif (isinstance(node, str) or isinstance(node, unicode)):
+             self.node = libxml2.parseDoc(node)

          self._registerNamespaces()




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click