I have a Persistent derived class where I want to upgrade from using a
PersistentList to a BTrees.IOBTree.IOBTree.

_articleList is the old Persistent list
_oidsToArticles is the new IOBTree.

    def __setstate__(self, state):
        articleList = state.get('_articleList')
        if articleList:
            oidsToArticles = self.makeBTree()
            for each in articleList:
                oidsToArticles[each.oid()] = each
            del state['_articleList']
            state['_oidsToArticles'] = oidsToArticles
        Persistent.__setstate__(self, state)

This seems to work fine, and I am adding more objects to
_oidsToArticles. The problem is that when I commit the transaction,
nothing is saved. I have tested the same code without __setstate__ and
then it saves just fine. What hoops does one have to jump through to
upgrade the state of a ZODB object?



_______________________________________________
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to