From 3530b7045a8fa5f91d5694b121d515fd2bb6f53e Mon Sep 17 00:00:00 2001 From: helmutm Date: Mon, 29 Dec 2008 15:05:55 +0000 Subject: [PATCH] work in progress: view work items git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3099 fd906abe-77d9-0310-91a1-e0d9ade77398 --- organize/interfaces.py | 14 ++++++++++++++ organize/work.py | 9 +++++++++ 2 files changed, 23 insertions(+) diff --git a/organize/interfaces.py b/organize/interfaces.py index b0bd4b3..58ed910 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -493,7 +493,21 @@ class IWorkItems(Interface): """ A collection (manager, container) of work items. """ + def __getitem__(key): + """ Return the work item identified by the key given. + """ + + def __iter__(): + """ Return an iterator of all work items. + """ + + def query(**criteria): + """ Search for tracks. Possible criteria are: task, party, run, + timeFrom, timeTo. + """ + def add(task, party, run=0, **kw): """ Create and register a work item; return it. Additional properties may be specified via keyword arguments. """ + diff --git a/organize/work.py b/organize/work.py index e389c29..b10d2a7 100644 --- a/organize/work.py +++ b/organize/work.py @@ -228,6 +228,15 @@ class WorkItems(object): def __iter__(self): return iter(self.context.values()) + def query(self, **criteria): + if 'task' in criteria: + criteria['taskId'] = criteria.pop('task') + if 'party' in criteria: + criteria['userName'] = criteria.pop('party') + if 'run' in criteria: + criteria['runId'] = criteria.pop('run') + return self.context.query(**criteria) + def add(self, task, party, run=0, **kw): trackId = self.context.saveUserTrack(task, run, party, {}) track = self[trackId]