GothenburgBitFactory / tasklib

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

Task object should not be iterable #13

Closed tbabej closed 9 years ago

tbabej commented 9 years ago

Right now, doing something as simple as:

t = Task(tw, description="random task")
t.save()
set(t)

will result to infinite cycles since Task object is iterable (since it defines getitem). Given the implementation of getitem, we never run out of possible keys to try.

We should probably limit getitem to a list of specific keywords. It would also help to remove the ambiguity with the keyword usage (which is inherited from Taskwarrior itself):

 t = Task(tw, description="random task")
 t = Task(tw, descriptio="random task")
 t = Task(tw, descripti="random task")
 t = Task(tw, desc="random task")

All of the above produce the same result.

tbabej commented 9 years ago

Fixed in develop.