[ZODB-Dev] TmpStore missing loadBefore

Tim Peters tim at zope.com
Sun Jun 26 12:27:57 EDT 2005


[Sidnei da Silva]
> We've hit a case where loadBefore would get called on TmpStore during
> plone.org migration.
>
> Unfortunately TmpStore doesn't implement loadBefore. There seems to be no
> tests for this. I tried to write one and provide a fix but just occurred
> me that TmpStore tries to be a 'simpler FileStorage that mixes with the
> current storage'.

This was fixed a few weeks, in rev 30825:

    http://svn.zope.org/ZODB/branches/3.4/?rev=30825&view=rev

If you don't care too much about the new test, it's just a matter of adding
the string "loadBefore" to this list in TmpStore.__init__:

        for method in (
            'getName', 'new_oid', 'modifiedInVersion', 'getSize',
            'undoLog', 'versionEmpty', 'sortKey', 'loadBefore',
            ):
            setattr(self, method, getattr(storage, method))

> Wouldn't it be simpler to make TmpStore subclass from FileStorage

No, because TmpStore is used by Connection (to support savepoints), and
Connection can't make assumptions about the _kind_ of storage in use.

> and just delegate to the current storage where appropriate?

Right, that's the purpose of the loop above.



More information about the ZODB-Dev mailing list