[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [bridgedb/master] Simplify MailResponse class by not implementing smtp.IMessage.
commit cbbbbf8aefc5061be6f28c4c09104ebc9d18d6a9
Author: Isis Lovecruft <isis@xxxxxxxxxxxxxx>
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.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits