From: Tomas Babej Date: Thu, 25 Dec 2014 17:40:29 +0000 (+0100) Subject: Task: Add workaround for task bug in older versions, which eats up a part of description X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/c7b2d1ec4f3b96ba04b216b1add37f915d1e5399?ds=sidebyside;hp=-c Task: Add workaround for task bug in older versions, which eats up a part of description --- c7b2d1ec4f3b96ba04b216b1add37f915d1e5399 diff --git a/tasklib/task.py b/tasklib/task.py index 9eff14c..330491f 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -228,16 +228,24 @@ class Task(TaskResource): def _get_modified_fields_as_args(self): args = [] + def add_field(field): + # Task version older than 2.4.0 ignores first word of the + # task description if description: prefix is used + if self.warrior.version < VERSION_2_4_0 and field == 'description': + args.append(self._data[field]) + else: + args.append('{0}:{1}'.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])) + add_field(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])) + add_field(field) return args