diff options
Diffstat (limited to 'item.py')
-rw-r--r-- | item.py | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- import time +from priority import Priorities class item: readOnly = ['id'] @@ -10,7 +11,7 @@ class item: if title != None: self.title = title self.created = created - self.priority = priority + self.setPriority(priority) self.description = description self.completed = completed self.removed = removed @@ -58,6 +59,14 @@ class item: def getDue(self): return self.due + def setPriority(self, id=None, name=None): + if id is not None: + self.priority = Priorities().getPriority(id = id) + elif name is not None: + self.priority = Priorities().getPriority(name = name) + else: + self.priority = None + def __setattr__(self, name, value): if name not in item.readOnly: if name not in self.__dict__ or self.__dict__[name] != value: |