Ticket #5852: 5852.3.patch
| File 5852.3.patch, 2.3 KB (added by moijes12, 8 months ago) |
|---|
-
twisted/mail/test/test_smtp.py
1518 1518 client.sentMail(199, "Test response", 1, addresses, client.log) 1519 1519 1520 1520 return onDone 1521 1522 1523 1524 class DeprecationTests(unittest.TestCase): 1525 """ 1526 Test for deprecations. 1527 """ 1528 1529 1530 def test_esmtpClientTlsModeDeprecation(self): 1531 """ 1532 Test deprecation of ESMTPClient.tlsMode. 1533 """ 1534 import warnings 1535 with warnings.catch_warnings(record=True) as w: 1536 warnings.simplefilter("default") 1537 from twisted.mail.smtp import ESMTPClient 1538 client = ESMTPClient('', '', '') 1539 self.assertEqual(len(w), 1) 1540 self.assertIdentical(w[-1].category, DeprecationWarning) 1541 self.assertEqual(str(w[-1].message), "tlsMode attribute of 1542 twisted.mail.smtp.ESMTPClient is deprecated since Twisted 1543 12.2") -
twisted/mail/topfiles/5852.removal
1 tlsMode attribute of twisted.mail.smtp.ESMTPClient was deprecated since Twisted 12.2. 2 No newline at end of file -
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 … … 1239 1240 # ClientContextFactory to use for STARTTLS 1240 1241 context = None 1241 1242 1243 def __setattr__(self, name, val): 1244 if name == 'tlsMode': 1245 warnings.warn("tlsMode attribute of twisted.mail.ESMTPClient is 1246 deprecated since Twisted 12.2", 1247 category=DeprecationWarning, stacklevel=2) 1248 1249 1242 1250 def __init__(self, secret, contextFactory=None, *args, **kw): 1243 1251 SMTPClient.__init__(self, *args, **kw) 1244 1252 self.authenticators = []
