From: Tomas Babej Date: Sat, 7 Feb 2015 11:35:31 +0000 (+0100) Subject: SerializingObject: Make sure UUID is properly validated X-Git-Url: https://git.madduck.net/etc/taskwarrior.git/commitdiff_plain/0110af91cb5bf3804efc35cb50c8430419af4313?hp=27f93e251029f1d93c92d8e1ac6a254bdb70ecdd SerializingObject: Make sure UUID is properly validated --- diff --git a/tasklib/task.py b/tasklib/task.py index 51c97d3..138ea7c 100644 --- a/tasklib/task.py +++ b/tasklib/task.py @@ -195,7 +195,13 @@ class SerializingObject(object): localized = value return localized - + + def normalize_uuid(self, value): + # Enforce sane UUID + if not isinstance(value, six.text_type) or value == '': + raise ValueError("UUID must be a valid non-empty string.") + + return value class TaskResource(SerializingObject):