[tor-commits] [bridgedb/develop] Simplify MailResponse class by not implementing smtp.IMessage.

isis at torproject.org isis at torproject.org
Fri Jun 6 20:40:38 UTC 2014


commit cbbbbf8aefc5061be6f28c4c09104ebc9d18d6a9
Author: Isis Lovecruft <isis at torproject.org>
Date:   Wed May 21 04:14:22 2014 +0000

    Simplify MailResponse class by not implementing smtp.IMessage.
    
    We aren't using it as an SMTP message delivery class anywhere, so
    there's no need to have the extra methods.
    
     * REMOVE bridgedb.email.server.MailResponse.lineReceived()
     * REMOVE bridgedb.email.server.MailResponse.eomReceived()
     * REMOVE bridgedb.email.server.MailResponse.connectionLost()
     * REMOVE zope.interface implementation declaration of
       twisted.mail.smtp.IMessage by b.e.s.MailResponse.
---
 lib/bridgedb/email/server.py |   30 ------------------------------
 1 file changed, 30 deletions(-)

diff --git a/lib/bridgedb/email/server.py b/lib/bridgedb/email/server.py
index 09df526..077bc17 100644
--- a/lib/bridgedb/email/server.py
+++ b/lib/bridgedb/email/server.py
@@ -286,9 +286,6 @@ class MailResponse(object):
     :cvar mailfile: An in-memory file for storing the formatted headers and
         body of the response email.
     """
-
-    implements(smtp.IMessage)
-
     _buff = buffer if NEW_BUFFER_INTERFACE else unicode
     mailfile = io.BytesIO if NEW_BUFFER_INTERFACE else io.StringIO
 
@@ -437,33 +434,6 @@ class MailResponse(object):
             body, _ = gpgSignMessage(self.gpgContext, body)
         self.writelines(body)
 
-    # The following methods implement the IMessage interface.
-
-    def lineReceived(self, line):
-        """Called when we receive a line from an underlying transport."""
-        self.write(line)
-
-    def eomRecieved(self):
-        """Called when we receive an EOM.
-
-        :rtype: :api:`twisted.internet.defer.Deferred`
-        :returns: A ``Deferred`` which has already been callbacked with the
-            entire response email contents retrieved from
-            :meth:`readContents`.
-        """
-        contents = self.readContents()
-        if not self.closed:
-            self.connectionLost()
-        return defer.succeed(contents)
-
-    def connectionLost(self):
-        """Called if we die partway through reading a message.
-
-        Truncate the :cvar:`mailfile` to null length, then close it.
-        """
-        self.mailfile.truncate(0)
-        self.mailfile.close()
-
 
 class MailMessage(object):
     """Plugs into the Twisted Mail and receives an incoming message.





More information about the tor-commits mailing list