[ZODB-Dev] Re: SVN: Zope3/branches/jim-adapter/src/zope/app/component/ Added compatibility for old pickles.

Florent Guillaume fg at nuxeo.com
Tue Apr 25 09:54:48 EDT 2006


Hi,

Jim Fulton wrote:
> Log message for revision 67595:
>   Added compatibility for old pickles.
>  
> Modified: Zope3/branches/jim-adapter/src/zope/app/component/tests/test_registration.py
> +# Work around a bug in ZODB
> +# XXX fix ZODB
> +class FileStorage(ZODB.FileStorage.FileStorage):
> +    
> +    def new_oid(self):
> +        self._lock_acquire()
> +        try:
> +            last = self._oid
> +            d = ord(last[-1])
> +            if d < 255:  # fast path for the usual case
> +                last = last[:-1] + chr(d+1)
> +            else:        # there's a carry out of the last byte
> +                last_as_long, = _structunpack(">Q", last)
> +                last = _structpack(">Q", last_as_long + 1)
> +            self._oid = last
> +            return last
> +        finally:
> +             self._lock_release()
> + 
> +

What's the ZODB bug? Why would new_oid be called for a readonly storage 
(which the original code checks)?

Florent

-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the ZODB-Dev mailing list