Logo Search packages:      
Sourcecode: zope-parsedxml version File versions

ParsedXML::tests::test_aqpain Namespace Reference


Detailed Description

Test that checks the fragility of using acquistion wrappers to
indicate tree hierarchy.

The current implementation of the DOM uses acquisition wrappers to
store references to a node's parent node.  While this allows very
efficient access to the parent, it is fragile in the case of multiple
wrappers referring to the same node.  If client code holds two
wrappers for a node and modifies the node's position in the tree using
one of them, the other will store incorrect information on the shape
of the tree.

For acquisition to be used to adequately be used to present the
containment hierarchy for a node, a complete chain of wrappers would
need to be constructed each time a node is reparented, starting from
the outermost node in the ancestor chain.  Application code would need
to be wary that old references to a node are replaced by the new
wrapper.  The Python DOM API makes no such requirement at the present
time, nor should it need to.

This script shows a contrived example that exercises this DOM bug.
While this particular code is unlikely in real applications, the ease
with which multiple acquisition wrappers can be produced in more
complex application code is easy to see.


Classes

class  AcquisitionPain

Functions

def main
def test_suite


Generated by  Doxygen 1.6.0   Back to index