[Zope3-dev] Re: help with directlyProvides
Jean-Marc Orliaguet
jmo at ita.chalmers.se
Sun May 7 17:42:38 EDT 2006
luis wrote:
> Jean-Marc Orliaguet wrote:
>
>
>> sorry I thought you wanted to do something else.. maybe you want to use
>> 'alsoProvides' if it is to set a marker, to avoid removing other
>> interfaces that the file might provide?
>>
>> /JM
>>
>
> nop. that's not it... I still havn't figured it out, but it seems very
> strange to me. it seems like folder-like objects work, but content-like
> objects don't..
>
> for example
>
> folder = Folder()
> interface.directlyProvides( folder, IMarker )
> file = File()
> interface.directlyProvides( file, IMarker )
> root['folder'] = folder
> root['file'] = file
>
> would leave "folder" directly providing the "IMarker" interface, but "file"
> directly providing nothing.
> the other strange thing is that the interface seems to be added to the
> provided-list, but then it is removed again later...so when you look at the
> introspector tab in the zmi, it's gone.
>
> regards.luis
>
>
are you sure? I tried with:
jmo at localhost ~/Zope3/src $ python2.4
Python 2.4.2 (#1, Dec 4 2005, 15:28:38)
Type "help", "copyright", "credits" or "license" for more information.
>>> from zope.app.file import file
>>> f = file.File()
>>> f
<zope.app.file.file.File object at 0xb7cbad2c>
>>> import zope.interface
>>> class IMarker(zope.interface.Interface):
... """Marker interface"""
...
>>> zope.interface.directlyProvides(f, IMarker)
>>> list(zope.interface.directlyProvidedBy(f))
[<InterfaceClass __main__.IMarker>]
>>> IMarker.providedBy(f)
True
hope it helps
/JM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope3-dev/attachments/20060507/55b189ac/attachment.htm
More information about the Zope3-dev
mailing list