[Zope-dev] [Checkins] SVN: zope.intid/trunk/ - Remove a dependency on ``zope.container.contained.Contained``

Michael Howitz mh at gocept.com
Fri May 15 02:46:12 EDT 2009


Am 15.05.2009 um 05:32 schrieb Chris McDonough:

> Log message for revision 99961:
>  - Remove a dependency on ``zope.container.contained.Contained``
>    (this is a dumb base class that defines __parent__ and __name__
>    as None and declares that the class implements IContained).

What's the reason behind this refactoring?
Instead of zope.container.contained.Contained the IntIds class now  
depends on zope.container.interface.IContained plus it redefines the  
things which are already defined in  
zope.container.contained.Contained. I do not see why this is better  
than using the base class.


> Changed:
>  U   zope.intid/trunk/CHANGES.txt
>  U   zope.intid/trunk/src/zope/intid/__init__.py
[...]

> Modified: zope.intid/trunk/src/zope/intid/__init__.py
> =====================================================
> --- zope.intid/trunk/src/zope/intid/__init__.py	2009-05-15 02:41:49  
> UTC (rev 99960)
> +++ zope.intid/trunk/src/zope/intid/__init__.py	2009-05-15 03:31:59  
> UTC (rev 99961)
> @@ -24,10 +24,9 @@
>
> import BTrees
> from persistent import Persistent
> -from ZODB.interfaces import IConnection
> from zope.component import adapter, getAllUtilitiesRegisteredFor,  
> subscribers
> from zope.container.interfaces import IObjectAddedEvent,  
> IObjectRemovedEvent
> -from zope.container.contained import Contained
> +from zope.container.interfaces import IContained
> from zope.event import notify
> from zope.interface import implements
> from zope.keyreference.interfaces import IKeyReference, NotYet
> @@ -37,14 +36,16 @@
> from zope.intid.interfaces import IIntIds, IIntIdEvent
> from zope.intid.interfaces import IntIdAddedEvent, IntIdRemovedEvent
>
> -class IntIds(Persistent, Contained):
> +class IntIds(Persistent):
>     """This utility provides a two way mapping between objects and
>     integer ids.
>
>     IKeyReferences to objects are stored in the indexes.
>     """
> -    implements(IIntIds)
> +    implements(IIntIds, IContained)
>
> +    __parent__ = __name__ = None
> +
>     _v_nextid = None

Yours sincerely,
-- 
Michael Howitz · mh at gocept.com · software developer
gocept gmbh & co. kg · forsterstraße 29 · 06112 halle (saale) · germany
http://gocept.com · tel +49 345 1229889 8 · fax +49 345 1229889 1
Zope and Plone consulting and development



More information about the Zope-Dev mailing list