Permalink
Browse files

Added ability to 'show' tasks by ids.

  • Loading branch information...
1 parent 07ecf82 commit b74e00a144b7b2985a62c60f2b57dab2414739b2 @svetlyak40wt committed Apr 1, 2009
Showing with 16 additions and 10 deletions.
  1. +0 −1 README.markdown
  2. +14 −8 gtd
  3. +2 −1 gtdzen/models.py
View
@@ -95,7 +95,6 @@ TODO
----
* automatic database migrations.
-* config file with basic options (where to store database, for example).
* bash/zsh autocomplete.
* task annotations.
* import/export to/from some XML format.
View
22 gtd
@@ -110,14 +110,20 @@ class CommandUI:
self.gtd.deleteTag(tag_id)
output(u'These tags were deleted')
- def cmd_show(self, tags = u'', mode = 'open'):
- "Show tasks, filtered by tags."
-
- with_tags, without_tags = _add_remove_tags(_parse_tags(tags))
- tasks = self.gtd.getTasks(
- tags = with_tags,
- without_tags = without_tags,
- show = mode)
+ def cmd_show(self, param = u'', mode = 'open'):
+ "Show tasks by ids or filtered by tags."
+
+ try:
+ if not param:
+ raise ValueError
+ tasks = [self.gtd.getTaskById(task_id) for task_id in _parse_ids(param)]
+ except ValueError:
+ with_tags, without_tags = _add_remove_tags(_parse_tags(param))
+ tasks = self.gtd.getTasks(
+ tags = with_tags,
+ without_tags = without_tags,
+ show = mode)
+
if len(tasks) > 0:
for task in tasks:
output(u'%d %s' % (task.id, task))
View
@@ -16,7 +16,8 @@ class Task(Entity):
using_options(tablename='tasks', order_by='-priority')
def __unicode__(self):
- return u'"%s" / %s (%s)' % (self.title, self.priority, ', '.join(map(unicode, self.tags)))
+ return u'"%s" / %s %s (%s)' % (
+ self.title, self.priority, self.done and 'CLOSED' or 'OPEN', ', '.join(map(unicode, self.tags)))
def __repr__(self):
return u'<Task "%s" with tags %s>' % (self.title, ', '.join(map(unicode, self.tags)))

0 comments on commit b74e00a

Please sign in to comment.