From: Tomas Babej Date: Fri, 19 Dec 2014 08:12:24 +0000 (+0100) Subject: Task: List all non-readable fields as modified when creating new task X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/4896cf0df68b68e931e621b7cb160fd566ae182d?ds=sidebyside Task: List all non-readable fields as modified when creating new task --- diff --git a/tasklib/task.py b/tasklib/task.py index 1202437..36f3c3b 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -201,8 +201,18 @@ class Task(TaskResource): def _get_modified_fields_as_args(self): args = [] - for field in self._modified_fields: - args.append('{}:{}'.format(field, self._data[field])) + + # If we're modifying saved task, simply pass on all modified fields + if self.saved: + for field in self._modified_fields: + args.append('{0}:{1}'.format(field, self._data[field])) + # For new tasks, pass all fields that make sense + else: + for field in self._data.keys(): + if field in self.read_only_fields: + continue + args.append('{0}:{1}'.format(field, self._data[field])) + return args def refresh(self, only_fields=[]):