VimwikiTask: Make task property use the cached attribute

This commit is contained in:
Tomas Babej 2015-03-13 22:22:50 +01:00
parent c333f1a275
commit 26c92ce3b7

View file

@ -21,6 +21,8 @@ class VimwikiTask(object):
self.tw = tw self.tw = tw
self.cache = cache self.cache = cache
self._task = None
match = re.search(GENERIC_TASK, line) match = re.search(GENERIC_TASK, line)
self.indent = match.group('space') self.indent = match.group('space')
self.text = match.group('text') self.text = match.group('text')
@ -75,13 +77,15 @@ class VimwikiTask(object):
try: try:
self._task = self.tw.tasks.get(uuid=self.uuid) self._task = self.tw.tasks.get(uuid=self.uuid)
except Task.DoesNotExist: except Task.DoesNotExist:
self.task = Task(self.tw) self._task = Task(self.tw)
# If task cannot be loaded, we need to remove the UUID # If task cannot be loaded, we need to remove the UUID
vim.command('echom "UUID not found: %s,' vim.command('echom "UUID not found: %s,'
'will be replaced if saved"' % self.uuid) 'will be replaced if saved"' % self.uuid)
self.uuid = None self.uuid = None
else: else:
self.task = Task(self.tw) self._task = Task(self.tw)
return self._task
@task.setter @task.setter
def task(self, task): def task(self, task):