[Twisted-Python] Notes on switching twisted to new zope.interface code
Eugene Coetzee
projects at reedflute.com
Mon Jul 19 14:31:58 MDT 2004
Itamar Shtull-Trauring wrote:
>1. Switch classes from:
>
> class C:
> __implements__ = IFoo,
>
>to:
>
> class C:
> zope.interface.implements(IFoo)
>
>and if you have third party subclasses that may depend on C having
>__implements__, also add:
>
> twisted.python.components.backwardsCompatImplements(C)
>
>
>2. Using zope.interface APIs directly is better, e.g. IFoo.providedBy(o)
>rather than components.implements(o, IFoo). But! If the object is third
>party, it may be using __implements__, and if the class never got
>processed by t.p.c it will not be hooked up to zope.interface at all.
>So, you may want to do:
>
> t.p.componets.fixClassImplements(o.__class__)
>
>this will make sure that __implements__ declarations get converted to
>new style implements declarations.
>
>3. Basically all of t.p.c is deprecated except for registerAdapter and
>the other APIs that talk to registry. Componentized is not, in theory,
>but hopefully will be replaced soon.
>
>
>
Sorry,
but can you please explain :
1) What is t.p.c and
2) Why would one want to use Zope's interfaces in places of Twisted
built-in interfaces
regards,
Eugene Coetzee
--
===============================================
Reedflute Software Solutions
Web -> www.reedflute.com
===============================================
More information about the Twisted-Python
mailing list