[Zope-dev] Re: [Checkins] SVN: zope.app.container/trunk/src/zope/app/container/btree.py Backward compatibility for revision 87368.

Benji York benji at zope.com
Fri Jun 13 15:47:38 EDT 2008


On Fri, Jun 13, 2008 at 3:26 PM, Christopher Combelles
<cvs-admin at zope.org> wrote:
> Log message for revision 87372:
>  Backward compatibility for revision 87368.
>  Previous BTreeContainer used to store their data in _SampleContainer__data.

It'd be a small improvement to use rwproperty
(http://pypi.python.org/pypi/rwproperty) for the below.

> -=-
> Modified: zope.app.container/trunk/src/zope/app/container/btree.py
> ===================================================================
> --- zope.app.container/trunk/src/zope/app/container/btree.py    2008-06-13 18:10:34 UTC (rev 87371)
> +++ zope.app.container/trunk/src/zope/app/container/btree.py    2008-06-13 19:26:38 UTC (rev 87372)
> @@ -114,3 +114,25 @@
>
>     def values(self, key=None):
>         return self.__data.values(key)
> +
> +    # transparent backward compatibility
> +    # since BTreeContainer does not inherit from SampleContainer
> +    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)
> +
> +
> +
-- 
Benji York
Senior Software Engineer
Zope Corporation


More information about the Zope-Dev mailing list