Hi,

While fixing some bugs in zope.app.container,
I've also modified the implementation of the BTreeContainer,
by not inheriting from the SampleContainer, and directly accessing the btree. This had remained as a TODO in the btree.py file, so I did it, but...


The result is all previous persisted BTreeContainers (such as PrincipalFolder) are broken because the btree used to be stored in self._SampleContainer__data, while the new implementation stores it in self._BTreeContainer__data.

So I've added a property to offer a transparent backward compatibility:

    def _get__data(self):
        try:
            return self._BTreeContainer__data
        except:
            return self._SampleContainer__data
    def _set__data(self, value):
        try:
            self._BTreeContainer__data = value
        except:
            self._SampleContainer__data = value
    def _del_data(self):
        try:
            del self._BTreeContainer__data
        except:
            del self._SampleContainer__data
    __data = property(_get__data, _set__data, _del_data)



Do you think it is safe? Is there any better solution for this? Should I rather write an evolution script? Or should I revert all this back to inheriting from SampleContainer?

Christophe
_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
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