Ticket #5852: 5852.7.patch
| File 5852.7.patch, 3.4 KB (added by lvh, 4 months ago) |
|---|
-
twisted/mail/smtp.py
8 8 9 9 import time, re, base64, types, socket, os, random, rfc822 10 10 import binascii 11 import warnings 11 12 from email.base64MIME import encode as encode_base64 12 13 13 14 from zope.interface import implements, Interface … … 158 159 return '\n'.join(res) 159 160 160 161 162 161 163 class ESMTPClientError(SMTPClientError): 162 164 """Base class for ESMTP client errors. 163 165 """ … … 1009 1011 self.code = -1 1010 1012 self.log = util.LineLog(logsize) 1011 1013 1014 1012 1015 def sendLine(self, line): 1013 1016 # Log sendLine only if you are in debug mode for performance 1014 1017 if self.debug: … … 1244 1247 self.authenticators = [] 1245 1248 self.secret = secret 1246 1249 self.context = contextFactory 1247 self.tlsMode = False1248 1250 1249 1251 1252 def __setattr__(self, name, value): 1253 if name == "tlsMode": 1254 warnings.warn("tlsMode attribute of twisted.mail.smtp.ESMTPClient is deprecated since Twisted 13.0", category=DeprecationWarning, stacklevel=2) 1255 self.__dict__[name] = value 1256 1257 1250 1258 def esmtpEHLORequired(self, code=-1, resp=None): 1251 1259 self.sendError(EHLORequiredError(502, "Server does not support ESMTP Authentication", self.log.str())) 1252 1260 -
twisted/mail/test/test_smtp.py
6 6 """ 7 7 8 8 from zope.interface import implements 9 import warnings 9 10 10 11 from twisted.python.util import LineLog 11 12 from twisted.trial import unittest, util 12 13 from twisted.protocols import basic, loopback 13 14 from twisted.mail import smtp 15 from twisted.mail.smtp import ESMTPClient 14 16 from twisted.internet import defer, protocol, reactor, interfaces 15 17 from twisted.internet import address, error, task 16 18 from twisted.test.proto_helpers import StringTransport … … 609 611 def test_loginAuth(self): 610 612 """ 611 613 L{ESMTPClient} can authenticate using the I{LOGIN} SASL mechanism. 612 614 613 615 @see: U{http://sepp.oetiker.ch/sasl-2.1.19-ds/draft-murchison-sasl-login-00.txt} 614 616 """ 615 617 realm = DummyRealm() … … 1518 1520 client.sentMail(199, "Test response", 1, addresses, client.log) 1519 1521 1520 1522 return onDone 1523 1524 1525 1526 class DeprecationTests(unittest.TestCase): 1527 """ 1528 Test for deprecations. 1529 """ 1530 1531 def test_esmtpClientTlsModeDeprecation(self): 1532 """ 1533 Test deprecation of ESMTPClient.tlsMode. 1534 """ 1535 client = ESMTPClient('', '', '') 1536 client.tlsMode = False 1537 warningsShown = self.flushWarnings([self.test_esmtpClientTlsModeDeprecation]) 1538 self.assertEqual(len(warningsShown), 1) 1539 self.assertIdentical(warningsShown[0]['category'], DeprecationWarning) 1540 self.assertEqual(warningsShown[0]['message'], "tlsMode attribute of twisted.mail.smtp.ESMTPClient is deprecated since Twisted 13.0") 1541 1542 test_esmtpClientTlsModeDeprecation.suppress = [] -
twisted/mail/topfiles/5852.removal
1 tlsMode attribute of twisted.mail.smtp.ESMTPClient is deprecated.
