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

Represent dependencies as sets and other improvements #14

Closed tbabej closed 9 years ago

tbabej commented 9 years ago

This makes depedency attribute work as it should, fixes issue #13 , and adds tests.

Also implements equality of the tasks objects and generates list of modified attributes by looking whether the actual values in the data dictionary changed.

tbabej commented 9 years ago

I wonder if I misinterpreted how Task object should store it's data in _data dict. Dependency sets are stored in _data dict as actual sets, while the actual convention is to store serialized value in there.

EDIT: This is wrong, it is actually seralized value stored there. I forgot about my own code :)

This was cuircumvented in this patchset by usage of format_depends method.

There is actually some value in storing the dependency set as set, as we may be losing some information in serializing since TW might not always be able to accept a serialized version that contains all the information (for example, with dependencies, you cannot redefine dependencies).

EDIT: I thought some more about this, and arrived to the conclusion that this is just fine. In the _data dict, we store the values as they appear in output of "task export" command, and this is not always the same format as is expected for the "task modify" command. This is where formatdepends come in. Actually, we should generalize this approach and have `formatmethods be automatically applied asserialize_anddeserialize_*` are.

tbabej commented 9 years ago

I pushed some more improvements, fixes and tests on top of this branch.

Edit: To sum up

tbabej commented 9 years ago

I consider this a final version of this set of improvements, please review dufing the weekend if you can :). I believe this is a bunch of valuable additions.

tbabej commented 9 years ago

Ok, I was a nasty liar in the last comment. I pushed some more improvements on top, and also extended the docs! Sorry that this is one nasty big branch, but I did not want to get lost in merging, since I was not sure how fast you would be with the reviews.

Fixes #12 .