~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Jelmer Vernooij
  • Date: 2011-12-01 23:10:02 UTC
  • mto: This revision was merged to the branch mainline in revision 6338.
  • Revision ID: jelmer@samba.org-20111201231002-6u7hjlzddpjybfn3
Deprecate ``RevisionSpec.wants_revision_history`` and remove any uses of it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
from __future__ import absolute_import
18
 
 
19
17
import errno
20
18
import os
21
19
import subprocess
22
20
import sys
23
21
import tempfile
 
22
import urllib
24
23
 
25
24
import bzrlib
26
25
from bzrlib import (
27
 
    config as _mod_config,
28
26
    email_message,
29
27
    errors,
30
28
    msgeditor,
112
110
        if body == '':
113
111
            raise errors.NoMessageSupplied()
114
112
        email_message.EmailMessage.send(self.config,
115
 
                                        self.config.get('email'),
 
113
                                        self.config.username(),
116
114
                                        to,
117
115
                                        subject,
118
116
                                        body,
312
310
            message_options['attachment'] = urlutils.local_path_to_url(
313
311
                attach_path)
314
312
        if body is not None:
315
 
            options_list = ['body=%s' % urlutils.quote(self._encode_safe(body))]
 
313
            options_list = ['body=%s' % urllib.quote(self._encode_safe(body))]
316
314
        else:
317
315
            options_list = []
318
316
        options_list.extend(["%s='%s'" % (k, v) for k, v in
354
352
        """See ExternalMailClient._get_compose_commandline"""
355
353
        compose_url = []
356
354
        if from_ is not None:
357
 
            compose_url.append('from=' + urlutils.quote(from_))
 
355
            compose_url.append('from=' + urllib.quote(from_))
358
356
        if subject is not None:
359
 
            # Don't use urlutils.quote_plus because Claws doesn't seem
 
357
            # Don't use urllib.quote_plus because Claws doesn't seem
360
358
            # to recognise spaces encoded as "+".
361
359
            compose_url.append(
362
 
                'subject=' + urlutils.quote(self._encode_safe(subject)))
 
360
                'subject=' + urllib.quote(self._encode_safe(subject)))
363
361
        if body is not None:
364
362
            compose_url.append(
365
 
                'body=' + urlutils.quote(self._encode_safe(body)))
 
363
                'body=' + urllib.quote(self._encode_safe(body)))
366
364
        # to must be supplied for the claws-mail --compose syntax to work.
367
365
        if to is None:
368
366
            raise errors.NoMailAddressSpecified()
379
377
                 extension, body=None, from_=None):
380
378
        """See ExternalMailClient._compose"""
381
379
        if from_ is None:
382
 
            from_ = self.config.get('email')
 
380
            from_ = self.config.get_user_option('email')
383
381
        super(Claws, self)._compose(prompt, to, subject, attach_path,
384
382
                                    mime_subtype, extension, body, from_)
385
383
 
618
616
        """See MailClient.compose"""
619
617
        try:
620
618
            return self._mail_client().compose(prompt, to, subject,
621
 
                                               attachment, mime_subtype,
 
619
                                               attachment, mimie_subtype,
622
620
                                               extension, basename, body)
623
621
        except errors.MailClientNotFound:
624
622
            return Editor(self.config).compose(prompt, to, subject,
625
 
                          attachment, mime_subtype, extension, body)
 
623
                          attachment, mimie_subtype, extension, body)
626
624
 
627
625
    def compose_merge_request(self, to, subject, directive, basename=None,
628
626
                              body=None):
637
635
                              help=DefaultMail.__doc__)
638
636
mail_client_registry.default_key = 'default'
639
637
 
640
 
opt_mail_client = _mod_config.RegistryOption('mail_client',
641
 
        mail_client_registry, help='E-mail client to use.', invalid='error')
 
638