GothenburgBitFactory / GothenburgBitFactory/tasklib
Error accessing original values from a on-modify hook
- Dominant language
- Python
- Stars
- 159
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I have taskwarrior 2.6.2, and tasklib 2.5.1-2 installed with pacman.
Calling original values from a `on-modify` hook throws an error. Below are the steps to reproduce the error using a 'minimal' config generated by taskwarrior, and no other hooks than `on-modify-tests`.
```python
#!/usr/bin/python3
import sys
from tasklib.task import Task
modified_task = Task.from_input()
old_tags = modified_task.original["tags"]
print(modified_task.export_data())
sys.exit(0)
```
Output:
```bash
❯ task 4 modify -test
Modifying task 4 'Some task'.
Traceback (most recent call last):
File "/home/user/.config/task/tests/hooks/on-modify-tests", line 13, in
old_tags = modified_task.original["tags"]
~~~~~~~~~~~~~~~~~~~^^^^^^^^
File "/usr/lib/python3.11/site-packages/tasklib/task.py", line 32, in __getitem__
return copy.deepcopy(self.viewed_dict.__getitem__(key))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'tags'
```
`task 4` does have a `test` tag originally, the same happens with `t.original['description']` anyway.
Thanks in advance for your help.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.