diff options
-rw-r--r-- | alot/commands/globals.py | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/alot/commands/globals.py b/alot/commands/globals.py index 885e3575..bcd9a2c3 100644 --- a/alot/commands/globals.py +++ b/alot/commands/globals.py @@ -793,33 +793,25 @@ class ComposeCommand(Command): if self.envelope.account is None: self.envelope.account = account - async def _set_signature(self, ui): + def _set_signature(self, ui): account = self.envelope.account if self.omit_signature or not account.signature: return logging.debug('has signature') sig = os.path.expanduser(account.signature) - if os.path.isfile(sig): - logging.debug('is file') - if account.signature_as_attachment: - name = account.signature_filename or None - self.envelope.attach_file(sig, filename = name) - logging.debug('attached') - else: - try: - with open(sig, 'r') as f: - sigcontent = f.read() - except UnicodeDecodeError: - ui.notify('Could not read signature', priority = 'error') - else: - self.envelope.body += '\n' + sigcontent + if account.signature_as_attachment: + name = account.signature_filename or None + self.envelope.attach_file(sig, filename = name) + logging.debug('attached') else: - ui.notify('could not locate signature: %s' % sig, - priority='error') - if (await ui.choice('send without signature?', 'yes', - 'no')) == 'no': - raise self.ApplyError + try: + with open(sig, 'r') as f: + sigcontent = f.read() + except UnicodeDecodeError: + ui.notify('Could not read signature', priority = 'error') + else: + self.envelope.body += '\n' + sigcontent async def apply(self, ui): try: @@ -963,7 +955,7 @@ class ComposeCommand(Command): await self._get_sender_details(ui) # add signature - await self._set_signature(ui) + self._set_signature(ui) # Figure out whether we should GPG sign messages by default # and look up key if so self._set_gpg_sign(ui) |