Ticket #5852: 5852.patch

File 5852.patch, 1.6 KB (added by moijes12, 2 years ago)

Are you looking for something like this ?

  • twisted/mail/test/test_smtp.py

     
    15181518        client.sentMail(199, "Test response", 1, addresses, client.log) 
    15191519 
    15201520        return onDone 
     1521 
     1522 
     1523class DeprecationTests(unittest.TestCase): 
     1524    """ 
     1525    Test for deprecations. 
     1526    """ 
     1527 
     1528     
     1529    def test_esmtpClientTlsModeDeprecation(self): 
     1530        """ 
     1531        Test deprecation of ESMTPClient.tlsMode. 
     1532        """ 
     1533        self.assertEqual(len(self.flushWarnings([smtp.ESMTPClient.setTlsMode])), 1)     
  • twisted/mail/smtp.py

     
    88 
    99import time, re, base64, types, socket, os, random, rfc822 
    1010import binascii 
     11import warnings 
    1112from email.base64MIME import encode as encode_base64 
    1213 
    1314from zope.interface import implements, Interface 
     
    12441245        self.authenticators = [] 
    12451246        self.secret = secret 
    12461247        self.context = contextFactory 
    1247         self.tlsMode = False 
     1248        self.setTlsMode(False) 
    12481249 
    12491250 
     1251    def setTlsMode(self, tlsMode=False): 
     1252        """ 
     1253        Setter method for setting tlsMode. 
     1254        """ 
     1255        warnings.warn("tlsMode is deprecated since Twisted 12.2", category=DeprecationWarning, stacklevel=2) 
     1256        self.tlsMode = tlsMode 
     1257 
     1258 
    12501259    def esmtpEHLORequired(self, code=-1, resp=None): 
    12511260        self.sendError(EHLORequiredError(502, "Server does not support ESMTP Authentication", self.log.str())) 
    12521261