1
<?xml version="1.0" encoding="utf-8"?><!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html lang="en" xmlns="http://www.w3.org/1999/xhtml">
3
<title>Twisted Documentation: The Twisted Zope Interfaces FAQ</title>
4
<link href="../../howto/stylesheet.css" rel="stylesheet" type="text/css"/>
8
<h1 class="title">The Twisted Zope Interfaces FAQ</h1>
9
<div class="toc"><ol><li><a href="#auto0">Twisted components system in 2.0</a></li><li><a href="#auto1">FAQ</a></li><ul><li><a href="#auto2">Why did Twisted switch to Zope Interfaces?</a></li><li><a href="#auto3">Why did Twisted switch to Zope Interfaces rather than PyProtocols?</a></li><li><a href="#auto4">Will this affect my deployment?</a></li><li><a href="#auto5">How can I update my own code?</a></li><li><a href="#auto6">
11
What about third party classes dependant on the old style of implements
14
</a></li><li><a href="#auto7">What about using third party classes?</a></li></ul><li><a href="#auto8">Acknowledgements</a></li></ol></div>
19
<h2>Twisted components system in 2.0<a name="auto0"/></h2>
21
<p>Twisted code's own use of the <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.python.components.html" title="twisted.python.components">twisted.python.components</a></code> package has been updated to use <a href="http://www.zope.org/Wikis/Interfaces/FrontPage" shape="rect">Zope Interfaces</a> in
24
<p>New code developed starting with the 2.0 release of Twisted Core should use Zope
25
Interfaces directly rather than using the twisted.python.components
28
<h2>FAQ<a name="auto1"/></h2>
30
<h3>Why did Twisted switch to Zope Interfaces?<a name="auto2"/></h3>
33
The twisted.python.components package is a large amount of on-going
34
maintenance. Using the Zope Interface package also provides a greater level of
35
compatibility between Twisted interfaces and Zope interfaces.
38
<h3>Why did Twisted switch to Zope Interfaces rather than PyProtocols?<a name="auto3"/></h3>
41
The Zope Interface package was chosen over PyProtocols because of its greater
42
conceptual similarity to twisted.python.components.
45
<h3>Will this affect my deployment?<a name="auto4"/></h3>
48
No. Releases of Twisted Core will include Zope Interfaces.
51
<h3>How can I update my own code?<a name="auto5"/></h3>
54
Classes written using twisted.python.components declare which interfaces they
55
implement in this style:
60
__implements__ = IFoo,
64
This should be changed to:
69
zope.interface.implements(IFoo)
74
What about third party classes dependant on the old style of implements
77
<a name="auto6"/></h3>
80
Use <code class="API"><a href="http://twistedmatrix.com/documents/10.0.0/api/twisted.python.components.backwardsCompatImplements.html" title="twisted.python.components.backwardsCompatImplements">backwardsCompatImplements</a></code> to fix this.
84
twisted.python.components.backwardsCompatImplements(C)
87
<h3>What about using third party classes?<a name="auto7"/></h3>
90
If you are using third party libraries that only declare __implements__, these
91
objects should be made compatible with <code base="twisted.python.components">fixClassImplements</code>: </p>
94
# import o where o is some third party library
95
from thirdparty.lib import o
97
twisted.python.components.fixClassImplements(o.__class__)
101
This will make sure that __implements__ declarations get converted to the new
102
style of implements declarations.
105
<h2>Acknowledgements<a name="auto8"/></h2>
107
<p>This document is the work of Jason A. Mobarak, with contributions from Mary
112
<p><a href="../../howto/index.html">Index</a></p>
113
<span class="version">Version: 10.0.0</span>
b'\\ No newline at end of file'