[Twisted-Python] policies.py change in 2.0
Hey guys, Question for you. In the 2.0 Twisted release the policies.ProtocolWrapper changed on line 31 to now set the wrappedProtocol.factory to point to the wrappingFactory. def __init__(self, factory, wrappedProtocol): self.wrappedProtocol = wrappedProtocol < self.factory = factory
self.factory = wrappedProtocol.factory = factory
I was wondering what the reason for the change was? The change caused our current code to break (an easy fix). It seems to me that the wrapper should be transparent to the wrappedProtocol. Changing the protocol's factory leads to unexpected behavior if that protocol is depending on specific methods or data in the factory. In fact this change actually breaks the Twisted smtp.py code. def getMailFrom(self): if not self.done: self.done = 1 / return str(self.factory.fromEmail) #this will now break if wrapped/ else: return None Brian Kirsch - Email Framework Engineer Open Source Applications Foundation 543 Howard St. 5th Floor San Francisco, CA 94105 (415) 946-3056 http://www.osafoundation.org
Glyph Lefkowitz wrote:
In fact this change actually breaks the Twisted smtp.py code. Wow. That does look broken. I suggest that if nobody explains this by the end of the day that the change be reverted right away...
Blame spiv. [0 tv@tao ~/src/twisted/trunk]$ svn log -v -r13494 ------------------------------------------------------------------------ r13494 | spiv | 2005-04-07 17:33:58 +0300 (Thu, 07 Apr 2005) | 1 line Changed paths: M /trunk/twisted/protocols/ftp.py M /trunk/twisted/protocols/policies.py M /trunk/twisted/test/test_ftp.py M /trunk/twisted/test/test_policies.py Refactor untested connection-limiting from FTP server to twisted.protocols.policies.LimitTotalConnectionsFactory, with tests. ------------------------------------------------------------------------
On Sat, 16 Apr 2005 20:00:17 +0300, Tommi Virtanen <tv@twistedmatrix.com> wrote:
Glyph Lefkowitz wrote:
In fact this change actually breaks the Twisted smtp.py code. Wow. That does look broken. I suggest that if nobody explains this by the end of the day that the change be reverted right away...
Blame spiv.
[0 tv@tao ~/src/twisted/trunk]$ svn log -v -r13494 ------------------------------------------------------------------------ r13494 | spiv | 2005-04-07 17:33:58 +0300 (Thu, 07 Apr 2005) | 1 line Changed paths: M /trunk/twisted/protocols/ftp.py M /trunk/twisted/protocols/policies.py M /trunk/twisted/test/test_ftp.py M /trunk/twisted/test/test_policies.py
Refactor untested connection-limiting from FTP server to twisted.protocols.policies.LimitTotalConnectionsFactory, with tests. ------------------------------------------------------------------------
Note that this change was post-2.0. Jp
participants (4)
-
Brian Kirsch
-
Glyph Lefkowitz
-
Jp Calderone
-
Tommi Virtanen