diff options
author | pazz <patricktotzke@gmail.com> | 2011-07-17 20:37:32 +0100 |
---|---|---|
committer | pazz <patricktotzke@gmail.com> | 2011-07-17 20:37:32 +0100 |
commit | f41daa2f9e59b8741be1e7b8ae200a3f577ec383 (patch) | |
tree | 199b517c781bd59eb2c525e8f845b9ae55163e71 /alot/commands.py | |
parent | a6cbde6c6154f50b701612569d073cbab86bd7cf (diff) |
fix retag to no tags
retag without parameter called itself before..
Diffstat (limited to 'alot/commands.py')
-rw-r--r-- | alot/commands.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/alot/commands.py b/alot/commands.py index 23499734..a030aa16 100644 --- a/alot/commands.py +++ b/alot/commands.py @@ -401,26 +401,32 @@ class ComposeCommand(Command): refocus=False)) -class ThreadTagCommand(Command): +class RetagPromptCommand(Command): """prompt the user for labels, then tag thread""" - def __init__(self, tagsstring=None, **kwargs): + def apply(self, ui): + thread = ui.current_buffer.get_selected_thread() + initial_tagstring = ','.join(thread.get_tags()) + ui.commandprompt('retag ' + initial_tagstring) + + +class RetagCommand(Command): + """prompt the user for labels, then tag thread""" + + def __init__(self, tagsstring=u'', **kwargs): self.tagsstring = tagsstring Command.__init__(self, **kwargs) def apply(self, ui): thread = ui.current_buffer.get_selected_thread() initial_tagstring = ','.join(thread.get_tags()) - if self.tagsstring == None: - ui.commandprompt('retag ' + initial_tagstring) - else: - tags = filter(lambda x: x, self.tagsstring.split(',')) - ui.logger.info("got %s:%s" % (self.tagsstring, tags)) - try: - thread.set_tags(tags) - except DatabaseROError, e: - ui.notify('index in read-only mode') - return + tags = filter(lambda x: x, self.tagsstring.split(',')) + ui.logger.info("got %s:%s" % (self.tagsstring, tags)) + try: + thread.set_tags(tags) + except DatabaseROError, e: + ui.notify('index in read-only mode') + return # flush index ui.apply_command(FlushCommand()) |