]>
git.madduck.net Git - etc/taskwarrior.git/blobdiff - tasklib/task.py
madduck's git repository
Every one of the projects in this repository is available at the canonical
URL git://git.madduck.net/madduck/pub/<projectpath> — see
each project's metadata for the exact URL.
All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@ git. madduck. net .
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
SSH access, as well as push access can be individually
arranged .
If you use my repositories frequently, consider adding the following
snippet to ~/.gitconfig and using the third clone URL listed for each
project:
[url "git://git.madduck.net/madduck/"]
insteadOf = madduck:
return self['description']
def __eq__(self, other):
return self['description']
def __eq__(self, other):
- return self['uuid'] == other['uuid']
+ if self['uuid'] and other['uuid']:
+ # For saved Tasks, just define equality by equality of uuids
+ return self['uuid'] == other['uuid']
+ else:
+ # If the tasks are not saved, compare the actual instances
+ return id(self) == id(other)
+
- return self['uuid'].__hash__()
+ if self['uuid']:
+ # For saved Tasks, just define equality by equality of uuids
+ return self['uuid'].__hash__()
+ else:
+ # If the tasks are not saved, return hash of instance id
+ return id(self).__hash__()
@property
def _modified_fields(self):
@property
def _modified_fields(self):
return self['uuid'] is not None or self['id'] is not None
def serialize_due(self, date):
return self['uuid'] is not None or self['id'] is not None
def serialize_due(self, date):
+ if not date:
+ return None
return date.strftime(DATE_FORMAT)
def deserialize_due(self, date_str):
return date.strftime(DATE_FORMAT)
def deserialize_due(self, date_str):
elif field == 'depends':
args.append('{0}:{1}'.format(field, self.format_depends()))
else:
elif field == 'depends':
args.append('{0}:{1}'.format(field, self.format_depends()))
else:
- args.append('{0}:{1}'.format(field, self._data[field]))
+ # Use empty string to substitute for None value
+ args.append('{0}:{1}'.format(field, self._data[field] or ''))
# If we're modifying saved task, simply pass on all modified fields
if self.saved:
# If we're modifying saved task, simply pass on all modified fields
if self.saved: