]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Patch by Per Cederqvist, seemingly approved by The Dragon:
authorGuido van Rossum <guido@python.org>
Wed, 21 Apr 1999 16:52:20 +0000 (16:52 +0000)
committerGuido van Rossum <guido@python.org>
Wed, 21 Apr 1999 16:52:20 +0000 (16:52 +0000)
Two problems: The SMTPRecipientsRefused class should not inherit
SMTPResponseException, since it doesn't provide the smtp_code and
smtp_error attributes.  My patch for not adding an extra CRLF was
apparently forgotten.  The enclosed patch fixes these two problems.

Lib/smtplib.py

index 0f202da2e10c0d221bf4c69beae193cf941d2303..370182e9f743fbbce5f26e49c84b279990470908 100755 (executable)
@@ -86,7 +86,7 @@ class SMTPSenderRefused(SMTPResponseException):
         self.sender = sender
         self.args = (code, msg, sender)
 
-class SMTPRecipientsRefused(SMTPResponseException):
+class SMTPRecipientsRefused(SMTPException):
     """All recipient  addresses refused.
     The errors for each recipient are accessable thru the attribute
     'recipients', which is a dictionary of exactly the same sort as 
@@ -371,8 +371,11 @@ class SMTP:
         if code <> 354:
             raise SMTPDataError(code,repl)
         else:
-            self.send(quotedata(msg))
-            self.send("%s.%s" % (CRLF, CRLF))
+            q = quotedata(msg)
+            if q[-2:] != CRLF:
+                q = q + CRLF
+            q = q + "." + CRLF
+            self.send(q)
             (code,msg)=self.getreply()
             if self.debuglevel >0 : print "data:", (code,msg)
             return (code,msg)