[Interface-dev] Twisted port status report
Jim Fulton
jim at zope.com
Thu Apr 29 17:32:02 EDT 2004
Itamar Shtull-Trauring wrote:
> I think I have all Twisted tests passing. I now need to backport z.i to
> 2.2. First issue I noticed was sets - alternatives include storing copy
> of it in zope.interface tarball and install it in 2.2, or just porting
> the appropriate code and making it pickle compatible.
I don't know what you mean. AFAIK, zope.interface doesn't use sets.
> The other thing I'd like to discuss is persistent adapters. In Twisted,
> if you do IFoo(o, persist=True), it'll keep the resulting adapter alive
> so long as o is alive (using weakrefs). For the backwards compat layer I
> just did that in Twisted's code (I subclass InterfaceClass and created
> my own Interface using that), but it's a useful function. Not
> necessarily as is, other suggestions have included having a special
> attribute on adapters indicating this is wanted, or specifying it as
> flag during adapter registration.
In particular, I thoought that, during PyCon, you suggested that you didn't
like this syntax.
It does seem more natural to me to have adapter persistence be either a
a feature of the adapter or a feature of the adapter declaration.
> You can see the code at:
> http://svn.twistedmatrix.com/cvs/trunk/sandbox/itamar/components.py?view=markup&rev=10624&root=Twisted
>
> one interesting bit of code is Componentized and Adapter and the way
> they interact. I'm not sure I really like the way they're currently
> implemented.
I don't find the class names very helpful. <shrug>
I *think* that the job of the Adapter class is to implement adapters
that, can themselves, be adapted to what the adapted objects can be
adapted to, but only via __conform__.
I'll note, FWIW, that we solved the problem that Componentized
solves via annotations. We don't make adapters persistent. Rather,
we make it possible to store extra data on the objects in an orderly
way. I like this approach, because it doesn't complicate the component
architecture.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Interface-dev
mailing list