[XML-SIG] [Bug #125896] Ods proble with checkpoints

noreply@sourceforge.net noreply@sourceforge.net
Fri, 15 Dec 2000 06:49:11 -0800


Bug #125896, was updated on 2000-Dec-15 06:49
Here is a current snapshot of the bug.

Project: Python/XML
Category: 4Suite
Status: Open
Resolution: None
Bug Group: None
Priority: 5
Submitted by: afayolle
Assigned to : nobody
Summary: Ods proble with checkpoints

Details: It's got to do with transactions and checkpoints. I guess Narval's bit
stressing the Ods Engine. I've attached a sample test file, widely
inspired from some code from Narval init. It runs as is, but if you
uncomment line 32, everything falls apart (and you get a stacktrace
similar to the one reported before). 

-------------------------8<--------------------------------
from Ft.DbDom import Dom
from Ft.Ods import Database
from Ft.DbDom import Reader
from xml.dom.ext import PrettyPrint,StripXml,Print
from Ft.Ods import FreePersistentObject

from xml.xpath import Evaluate

AL_NS = ''

class MemoryDocument(Dom.DocumentImp) :
    def __init__(self) :
        Dom.DocumentImp.__init__(self)
        self.eid_count = 1
        self.eid_ref_count = {}
        
    def add_element(self,element) :
        """if the element has not already an eid (== not yet in memory)
        assign unique id to the element and append it to memory.
        """
        global tx
        eid = element.getAttributeNS(AL_NS,'eid')
        if not eid :
            eid = str(self.eid_count)
            element.setAttributeNS(AL_NS,'eid',eid)
            self.eid_count = self.eid_count + 1
            self.eid_ref_count[eid] = 1

            self.documentElement.appendChild(element)

            ### Uncomment following line to see the bug
            #tx.checkpoint()

            for node in self.documentElement.childNodes[:] :
                if node.tagName == 'plan' :
                    node.element_change(element)

        return eid, element


DBNAME='ods:alf@orion:5432:dom_test'

mydoc='''<root><child id="1"><info/></child>
<child id="2"><info>foo</info></child></root>'''

db = Database.Database()
db.open(DBNAME)
tx = db.new()
tx.begin()

doc = MemoryDocument()

e = doc.createElementNS('','elt')
doc.appendChild(e)
tx.checkpoint()
r = Reader.DbDomReader()

frag = r.fromString(mydoc,doc)

map(doc.add_element, Evaluate('root/child',frag))

tx.commit()

PrettyPrint(doc)




For detailed info, follow this link:
http://sourceforge.net/bugs/?func=detailbug&bug_id=125896&group_id=6473