[Zope-dev] XMLDocument, a bug with the fix

Ibaņez Palomar Juan David al028823@alumail.uji.es
Thu, 27 Jan 2000 13:21:53 +0100 (NFT)


Hi,


(first, excuse my english, please)


I downloaded from http://www.zope.org/Products/XMLDocument the
latest two releases and found one differnet bug in each of them.

* 1.0a3
  - the test code,
      entry = self.getOwnerDocument().createElement('entry')
      return entry.getParentNode() 

  - the problem,
      getParentNode should return None but it doesn't
      (it returns self or something else, I don't remember)

* 1.0a4
  - the test code,
     entry = self.getOwnerDocument().createElement('entry')
     return entry.getOwnerDocument() == self.getOwnerDocument()

  - the problem,
     self.getOwnerDocument() and entry.getOwnerDocument() are different,
     they should be the same object.


Both errors make other methods to fail, such as appendChild.

I've wrote about the two releases because I'm not sure whether the
1.0a4 really is the 1.0a4 or not (1.0a3 is 1.0a4 and vice versa?).
The CHANGES.txt file in the Zope site makes me to think the last.


Anyway, I've solved the problem (I think), the diff with the 1.0a4
release is:

290c290,293
<         return self.ownerDocument   
---
>         try:
>             return self.ownerDocument.aq_self
>         except AttributeError:
>             return None


I'm not sure if this is the right solution but I think it's a good one.


Hope to be helpful,
David



PS: the Howto "http://www.zope.org/Members/htrd/howto/aq_order" helped
    me to diagnose the problem, thanks to Toby Dickenson.