Commit 6250df4b authored by Jacek Sowiński's avatar Jacek Sowiński

Support backups in column-ui

parent 78850e9f
...@@ -189,17 +189,20 @@ class CLIApplicationBase(object): ...@@ -189,17 +189,20 @@ class CLIApplicationBase(object):
READ_ONLY_COMMANDS) READ_ONLY_COMMANDS)
return p_command.__module__.endswith(read_only_commands) return p_command.__module__.endswith(read_only_commands)
def _execute(self, p_command, p_args): def _backup(self, p_command, p_args):
"""
Execute a subcommand with arguments. p_command is a class (not an
object).
"""
if config().backup_count() > 0 and p_command and not self.is_read_only(p_command): 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" call = [p_command.__module__.lower()[16:-7]] + p_args # strip "topydo.commands" and "Command"
from topydo.lib.ChangeSet import ChangeSet from topydo.lib.ChangeSet import ChangeSet
self.backup = ChangeSet(self.todolist, p_call=call) 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( command = p_command(
p_args, p_args,
self.todolist, self.todolist,
......
...@@ -125,6 +125,8 @@ class UIApplication(CLIApplicationBase): ...@@ -125,6 +125,8 @@ class UIApplication(CLIApplicationBase):
p_command = shlex.split(p_command) p_command = shlex.split(p_command)
(subcommand, args) = get_subcommand(p_command) (subcommand, args) = get_subcommand(p_command)
self._backup(subcommand, args)
try: try:
command = subcommand( command = subcommand(
args, 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