Ticket #5852: 5852.4.patch
| File 5852.4.patch, 3.2 KB (added by moijes12, 8 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: … … 1247 1250 self.tlsMode = False 1248 1251 1249 1252 1253 def __setattr__(self, name, value): 1254 if name == "tlsMode": 1255 warnings.warn("twisted.mail.smtp.ESMTPClient is deprecated since Twisted 12.2", category=DeprecationWarning, stacklevel=2) 1256 self.__dict__[name] = value 1257 1258 1250 1259 def esmtpEHLORequired(self, code=-1, resp=None): 1251 1260 self.sendError(EHLORequiredError(502, "Server does not support ESMTP Authentication", self.log.str())) 1252 1261 -
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 1532 def test_esmtpClientTlsModeDeprecation(self): 1533 """ 1534 Test deprecation of ESMTPClient.tlsMode. 1535 """ 1536 client = ESMTPClient('', '', '') 1537 warningsShown = self.flushWarnings() 1538 self.assertEqual(len(warningsShown), 1) 1539 self.assertIdentical(warningsShown[0]['category'], DeprecationWarning) 1540 self.assertEqual(warningsShown[0]['message'], 1541 "twisted.mail.smtp.ESMTPClient is deprecated since Twisted 12.2") 1542 1543 test_esmtpClientTlsModeDeprecation.suppress = [] -
twisted/mail/topfiles/5852.removal
1 tlsMode attribute of twisted.mail.smtp.ESMTPClient is deprecated.
