ralphbean / taskw

python taskwarrior api
http://threebean.org
GNU General Public License v3.0
176 stars 47 forks source link

Remove obsolete 'priority' built-in field. #154

Open coddingtonbear opened 2 years ago

coddingtonbear commented 2 years ago

As long ago as Taskwarrior 2.4.3, the priority field is no longer a built-in field (https://taskwarrior.org/docs/priority.html), and should users re-define priority as a UDA having values other than H, M, and L while the aforementioned field definition is in place, an exception will be raised when deserializing:

Traceback (most recent call last):
  ...
  File "/src/taskw/taskw/task.py", line 197, in serialized
    serialized[k] = self._serialize(k, v, self._fields)
  File "/src/taskw/taskw/task.py", line 116, in _serialize
    return converter.serialize(value)
  File "/src/taskw/taskw/fields/choice.py", line 34, in serialize
    raise ValueError(
ValueError: '0' is not a valid choice; choices: [None, 'H', 'M', 'L']
bergercookie commented 9 months ago

For reference, this would happen during serialization, not deserialization, and AFAICT this is no longer an issue with taskw since UDAs at the time of testing this do update existing fields, e.g., for the priority field.

The relevant part of the code is here: https://github.com/ralphbean/taskw/blob/3256c92bed4bb3d53269c843e8201e9ac65780cc/taskw/task.py#L68-L70