diff options
author | Anton Khirnov <anton@khirnov.net> | 2020-02-19 16:13:32 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2020-02-19 16:13:32 +0100 |
commit | 4178d0c4850fbf5e509e2f267bef87a06384efc7 (patch) | |
tree | 9272587dbe8cd6c8aa180efbef9f9f1108c815ed /alot/commands/thread.py | |
parent | 2cd85de1cd1be47614d261fdbd19a6ebc351c2ef (diff) |
commands/thread: replace isinstance() with hasattr()
This is more correct.
Diffstat (limited to 'alot/commands/thread.py')
-rw-r--r-- | alot/commands/thread.py | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/alot/commands/thread.py b/alot/commands/thread.py index 89b278ce..26045ca8 100644 --- a/alot/commands/thread.py +++ b/alot/commands/thread.py @@ -39,7 +39,6 @@ from ..settings.const import settings from ..helper import parse_mailcap_nametemplate from ..helper import split_commandstring from ..utils import argparse as cargparse -from ..widgets.globals import AttachmentWidget MODE = 'thread' @@ -834,7 +833,7 @@ class SaveAttachmentCommand(Command): raise CommandCanceled() else: # save focussed attachment focus = ui.get_deep_focus() - if isinstance(focus, AttachmentWidget): + if hasattr(focus, 'attachment'): filename = focus.attachment.get_filename() if not self.path: msg = 'save attachment (%s) to ' % filename @@ -973,7 +972,7 @@ class ThreadSelectCommand(Command): - if it is an attachment line, open the attachment""" async def apply(self, ui): focus = ui.get_deep_focus() - if isinstance(focus, AttachmentWidget): + if hasattr(focus, 'attachment'): logging.info('open attachment') await ui.apply_command(OpenAttachmentCommand(focus.attachment)) else: |