Closed tbabej closed 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 as
serialize_and
deserialize_*` are.
I pushed some more improvements, fixes and tests on top of this branch.
Edit: To sum up
__eq__
and __hash__
for Task objects_original_data
along with _data
, uses that for generating list of modified attributesTask
object non-iterable__init__
, this allows same behaviour from tasklib user's perspectiveformat_*
methods, that take care of modifing the serialized value to value for task modifyconfirmation:no
by defaultI 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.
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 .
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.