tasklib
tasklib copied to clipboard
Add coverage and support for user-defined attributes
Even though one can use user-defined attributes with tasklib, we:
- Do not provide any official interface for them (one has to update the config dict). This maybe does not need to change.
- Do not cover the use case in tests
Some support will be needed though, since UDAs can have date
values, and we need to serialize/deserialize that.
Would love to see this implemented. As a workaround, I thought I'd post the hack I'm using to handle deserializing UDA dates:
import datetime
from tasklib.serializing import SerializingObject
serializer = SerializingObject({})
# dt is the UDA value I get from tasklib, I detect if it's already a datetime
# object for forwards-compatibility.
dt = dt if isinstance(dt, datetime.datetime) else serializer.timestamp_deserializer(dt)
Do I correctly presume that there is no builtin way to parse the UDA of duration
type? That'd be really nice to have as well ;)
I'm hand coding a minimal enough parser, however a properly tested (and implemented) one would be fully in order.
https://github.com/allgreed/tw-ical-feed/commit/1af68f76112600670e51dba431fa66009100f70d#diff-b10564ab7d2c520cdd0243874879fb0a782862c3c902ab535faabe57d5a505e1R63