[z3-five] Marker interfaces in Five 1.0.2

Philipp von Weitershausen philipp at weitershausen.de
Fri Feb 9 21:42:54 CET 2007


whit wrote:
> Andreas Jung wrote:
>> Hi,
>>
>> don't stone me to death but is there a way to attach marker interfaces
>> of objects in Five 1.0.2?
>>
>> Andreas
>>
> 
> does this not work?
> 
> from zope.interface import directlyProvidedBy
> from zope.interface import directlyProvides
> 
> def mark(ob, interface):
>      directlyProvides(ob, directlyProvidedBy(ob), interface)

Actually, you probably might want to stick the marker interfaces to the 
beginning:

   def mark(ob, *interfaces):
       directlyProvides(ob, *interfaces, directlyProvidedBy(ob))

Since Zope 3.2 this function is part of the zope.interface package and 
called "alsoProvides".


-- 
http://worldcookery.com -- Professional Zope documentation and training
Next Zope 3 training at Camp5: http://trizpug.org/boot-camp/camp5


More information about the z3-five mailing list