X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/blobdiff_plain/0ea1b0d359dc80d2bef66971b523a26515e90fee..faa9531194cd3657ce1e2f40e6e8067ac546958c:/tasklib/task.py diff --git a/tasklib/task.py b/tasklib/task.py index f7afbf2..3a58e50 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -132,6 +132,11 @@ class Task(TaskResource): def __init__(self, warrior, **kwargs): self.warrior = warrior + # Check that user is not able to set read-only value in __init__ + for key in kwargs.keys(): + if key in self.read_only_fields: + raise RuntimeError('Field \'%s\' is read-only' % key) + # We serialize the data in kwargs so that users of the library # do not have to pass different data formats via __setitem__ and # __init__ methods, that would be confusing