[Zope] XMLDocument "WrongDocument" error and object comparision...
Anthony Baxter
anthony@ekit-inc.com
Thu, 24 Feb 2000 15:19:20 +1100
I'm playing with XML Document, and I'm finding that I'm getting a
bogus WrongDocument error from the sample file. If I open up the
'slides' document and hit 'Change' I'm getting a WrongDocument
exception at line 433 of Node.py.
if document and ownerDocument and document != ownerDocument:
raise ZDOM.WrongDocumentException()
(I also see this when I try to create a new document)
Putting a
print "DOC", document, ownerDocument
print "DOC2", id(document), id(ownerDocument)
on the line before it gives back
DOC <Document instance at 863bf90> <Document instance at 863bf90>
DOC2 139736152 139811552
so they _look_ like the same object, but comparision is failing.
On a hunch, I tried changing the code to compare document.aq_base
and ownerDocument.aq_base, and this works. I have _no_ idea if this is
correct, though.
I'm running the latest CVS, including Jim's changes to Acquisition.c (r1.36)
for numeric object comparision - could this be the problem?
anyone?
Anthony
(patch to make it work for me: )
--- Node.py 2000/02/05 00:33:16 1.18
+++ Node.py 2000/02/24 04:17:55
@@ -430,7 +430,7 @@
raise ZDOM.HierarchyRequestException('Node type does not support children.')
document=newChild.getOwnerDocument()
ownerDocument=self.getOwnerDocument()
- if document and ownerDocument and document != ownerDocument:
+ if document and ownerDocument and document.aq_base != ownerDocument.aq_base:
raise ZDOM.WrongDocumentException()
if newChild.getNodeType() == DOCUMENT_FRAGMENT_NODE:
newChildren=newChild