[Zope-dev] Re: ZDOM patches

Anthony Pfrunder s341625@student.uq.edu.au
Tue, 19 Oct 1999 08:00:08 +1000 (GMT+1000)


On Mon, 18 Oct 1999, Martijn Faassen wrote:

> Anthony Pfrunder wrote:
[snippy snip]
> > A new version will be out in a few weeks once the DOM patches filter through
Hmm, this might be a *few* weeks so don't hold your breath.  I've got to
fix that DTML ZClass problem first.

> Which DOM patches are this? Did you notify Amos? I'm curious about them
> myself, too, as I ran into some problems with XMLWidgets about which
> I've been in communication with Amos. So please enlighten me. :)

Hi,

I'll submit them again but basically this is how to patch it:
	* For all creation DOM methods (clone, createXX ...) you need
	  to add some hidden magical methods to stop weird errors from 
	  occuring.  Here is how:

# This makes the aquisition path point to the current containing
# document.  These attributes doesn't exist after a creation call hence,
# aquisition doesn't work properly.

def XMLpatch(self, p):
	p.aq_acquire = self.aq_acquire
	p.aq_base = self.aq_base
	return p

Then, for each creation call wrap it like such:

def createTextNode(self, data):
	return self.XMLpatch(Document.createTextNode(self, data)) 

here, Document is an XML document and data is the actual content of the
Text Node (I think).

Cheers,

Anthony Pfrunder