[Zope3-dev] Re: "most specific" interface?
Florent Guillaume
fg at nuxeo.com
Fri Sep 16 09:27:25 EDT 2005
Philipp von Weitershausen wrote:
> >>> from zope.app.content.interfaces import IContentType
> >>> from zope.app.file.interfaces import IFile
> >>> from zope.interface import directlyProvides
> >>> directlyProvides(IFile, IContentType)
Watch out! directlyProvides is evil, it *replaces* the interfaces provided
by something. Here, if IFile implemented something else, it would be lost.
You should always use:
directlyProvides(ob, ISomething, directlyProvidedBy(ob))
(Or use a convenience method to do that, I'm not sure if alsoProvides() was
ever implemented.)
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com fg at nuxeo.com
More information about the Zope3-dev
mailing list