Commit 03c640a6 authored by Bram Schoenmakers's avatar Bram Schoenmakers

Merge pull request #92 from mruwek/column-ui-backups

Support backups (and `revert`) in column ui
parents 44811b80 6250df4b
......@@ -189,17 +189,20 @@ class CLIApplicationBase(object):
READ_ONLY_COMMANDS)
return p_command.__module__.endswith(read_only_commands)
def _execute(self, p_command, p_args):
"""
Execute a subcommand with arguments. p_command is a class (not an
object).
"""
def _backup(self, p_command, p_args):
if config().backup_count() > 0 and p_command and not self.is_read_only(p_command):
call = [p_command.__module__.lower()[16:-7]] + p_args # strip "topydo.commands" and "Command"
from topydo.lib.ChangeSet import ChangeSet
self.backup = ChangeSet(self.todolist, p_call=call)
def _execute(self, p_command, p_args):
"""
Execute a subcommand with arguments. p_command is a class (not an
object).
"""
self._backup(p_command, p_args)
command = p_command(
p_args,
self.todolist,
......
......@@ -125,6 +125,8 @@ class UIApplication(CLIApplicationBase):
p_command = shlex.split(p_command)
(subcommand, args) = get_subcommand(p_command)
self._backup(subcommand, args)
try:
command = subcommand(
args,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment