~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/mail_client.py

  • Committer: Aaron Bentley
  • Date: 2007-08-10 17:34:14 UTC
  • mto: (2681.5.3 bzr-mail)
  • mto: This revision was merged to the branch mainline in revision 2736.
  • Revision ID: abentley@panoramicfeedback.com-20070810173414-hwj1jpzbnh87c8cc
Handle default mail client by trying xdg-email, falling back to editor

Show diffs side-by-side

added added

removed removed

Lines of Context:
143
143
        if attach_path is not None:
144
144
            commandline.extend(['--attach', attach_path])
145
145
        return commandline
 
146
 
 
147
 
 
148
class DefaultMail(MailClient):
 
149
    """Default mail handling.  Tries XDGEmail, falls back to Editor"""
 
150
    def compose(self, prompt, to, subject, attachment, mime_subtype,
 
151
                extension):
 
152
        try:
 
153
            return XDGEmail(self.config).compose(prompt, to, subject,
 
154
                            attachment, mimie_subtype, extension)
 
155
        except errors.MailClientNotFound:
 
156
            return Editor(self.config).compose(prompt, to, subject,
 
157
                          attachment, mimie_subtype, extension)
 
158
 
 
159
    def compose_merge_request(self, to, subject, directive):
 
160
        try:
 
161
            return XDGEmail(self.config).compose_merge_request(to, subject,
 
162
                            directive)
 
163
        except errors.MailClientNotFound:
 
164
            return Editor(self.config).compose_merge_request(to, subject,
 
165
                          directive)