/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/email_message.py

  • Committer: Jelmer Vernooij
  • Date: 2018-11-16 23:15:15 UTC
  • mfrom: (7180 work)
  • mto: This revision was merged to the branch mainline in revision 7183.
  • Revision ID: jelmer@jelmer.uk-20181116231515-zqd2yn6kj8lfydyp
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
71
71
        self._parts = []
72
72
 
73
73
        if isinstance(to_address, (bytes, text_type)):
74
 
            to_address = [ to_address ]
 
74
            to_address = [to_address]
75
75
 
76
76
        to_addresses = []
77
77
 
170
170
        msg = EmailMessage(from_address, to_address, subject, body)
171
171
        if attachment is not None:
172
172
            msg.add_inline_attachment(attachment, attachment_filename,
173
 
                    attachment_mime_subtype)
 
173
                                      attachment_mime_subtype)
174
174
        SMTPConnection(config).send_email(msg)
175
175
 
176
176
    @staticmethod
180
180
        :param address: An unicode string, or UTF-8 byte string.
181
181
        :return: A possibly RFC2047-encoded string.
182
182
        """
183
 
        if not isinstance(address,(str, text_type)):
 
183
        if not isinstance(address, (str, text_type)):
184
184
            raise BzrBadParameterNotUnicode(address)
185
185
        # Can't call Header over all the address, because that encodes both the
186
186
        # name and the email address, which is not permitted by RFCs.
189
189
            return email
190
190
        else:
191
191
            return formataddr((str(Header(safe_unicode(user))),
192
 
                email))
 
192
                               email))
193
193
 
194
194
    @staticmethod
195
195
    def string_with_encoding(string_):