[Twisted-Python] A new & improved IResource
glyph at twistedmatrix.com
Sun Jul 24 17:22:04 MDT 2011
On Jul 24, 2011, at 2:13 PM, James Y Knight wrote:
> On Jul 24, 2011, at 11:36 AM, Laurens Van Houtven wrote:
>> I've been looking at this again recently and honestly it's beginning to feel like I'm reimplementing large parts of web2. Does that mean I'm doing it wrong?
> Either that or that web2 was doing it right...
> Of course, you don't really need to reimplement it, just copy the existing implementation from before it was removed, and s/web2/web/. :)
The main thing that web2 did wrong was introducing a new namespace and thereby confusion, not any particular detail of its implementation.
The web2 resource model was in most ways a nice upgrade from twisted.web. It even had a halfway decent compatibility layer. You should feel free to copy its implementation liberally (with the exception of the IStream interface, which has been discussed to death elsewhere). However, since web2 was half-baked in some regards, you may need to add test coverage, improve docstrings, or handle some corner cases in order to pass review.
But, in terms of implementation details, web2 was in fact "doing it right" for the most part.
More information about the Twisted-Python