GothenburgBitFactory / tasklib

A Python library for interacting with taskwarrior databases.
http://tasklib.readthedocs.org/en/latest/
BSD 3-Clause "New" or "Revised" License
148 stars 28 forks source link

Colons in tags should be automatically escaped #129

Open mpenning opened 11 months ago

mpenning commented 11 months ago

If you add a tag named 'completion:20', you get a bogus '20' key entry in Task()._data. If the aforementioned tag with a colon is added via tasklib, it should not create a '20' key in Task()._data.

Explicit example:

import tasklib

tw = tasklib.TaskWarrior()
task = tasklib.Task(tw, description="My new task", due="2023-12-28")
task['tags'] = ["completion:20"]
print(task._data)

This prints:

{'id': 1, '20': 'x', 'description': 'My new task', 'due': datetime.datetime(2023, 12, 28, 0, 0, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=64800), 'CST')), 'entry': datetime.datetime(2023, 12, 27, 15, 50, 30, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=64800), 'CST')), 'modified': datetime.datetime(2023, 12, 27, 15, 50, 30, tzinfo=datetime.timezone(datetime.timedelta(days=-1, seconds=64800), 'CST')), 'status': 'pending', 'uuid': '19fcabd2-636c-43a0-b324-83e622001943', 'tags': {'completion:20'}, 'urgency': 17.5446}

The '20' key above seems to be a colon escaping bug, unless this behavior is intentional.