From 2094355d84e86a5a8d7d32bb016018c99aef6397 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 27 Dec 2008 10:41:50 +0000 Subject: [PATCH] work in progress: task management with work items git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3086 fd906abe-77d9-0310-91a1-e0d9ade77398 --- organize/interfaces.py | 2 +- organize/work.py | 10 +++++----- tracking/btree.py | 14 ++++++++------ 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/organize/interfaces.py b/organize/interfaces.py index 8a677a3..04c1e12 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -452,7 +452,7 @@ class IWorkItem(Interface): created = Attribute('The timeStamp of the initial creation of the work item.') assigned = Attribute('The timeStamp of the assignment of the work item.') predecessor = Attribute('Optional: a work item this work item was created from.') - continuation = Attribute('Optional: a work item that was created from this one ' + successor = Attribute('Optional: a work item that was created from this one ' 'to continue the work.') newTask = Attribute('Optional: a new task that has been created based ' 'on this work item.') diff --git a/organize/work.py b/organize/work.py index 6b59917..c89a88c 100644 --- a/organize/work.py +++ b/organize/work.py @@ -47,8 +47,9 @@ def workItemStates(): State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'), color='orange'), State('finished', 'finished', (), color='green'), - State('continued', 'continued', (), color='blue'), - State('transferred', 'transferred', (), color='lightblue'), + State('continued', 'continued', ('finish', 'cancel'), color='blue'), + State('transferred', 'transferred', ('finish', 'cancel'), + color='lightblue'), State('cancelled', 'cancelled', (), color='grey'), Transition('assign', 'assign', 'assigned'), Transition('start', 'start', 'running'), @@ -169,8 +170,8 @@ class WorkItemTrack(WorkItem, Track): new = workItems.add(self.taskId, self.userName, self.runId, **newData) if transition == 'continue': new.assign() - new.data['predecessor'] = self.__name__ - self.data['continuation'] = new.__name__ + new.data['predecessor'] = getName(self) + self.data['successor'] = getName(new) return new def reindex(self): @@ -178,7 +179,6 @@ class WorkItemTrack(WorkItem, Track): def checkOverwrite(self, kw): for k, v in kw.items(): - #old = data.get(k) old = getattr(self, k, None) if old is not None and old != v: raise ValueError("Attribute '%s' already set to '%s'." % (k, old)) diff --git a/tracking/btree.py b/tracking/btree.py index 061d1a3..bc58f82 100644 --- a/tracking/btree.py +++ b/tracking/btree.py @@ -23,14 +23,13 @@ $Id$ """ import time - -from zope.interface import implements -from zope.app.container.btree import BTreeContainer -from zope.index.field import FieldIndex - from persistent import Persistent from BTrees import OOBTree, IOBTree from BTrees.IFBTree import intersection, union +from zope.interface import implements +from zope.app.container.btree import BTreeContainer +from zope.index.field import FieldIndex +from zope.traversing.interfaces import IPhysicallyLocatable from interfaces import IRun, ITrackingStorage, ITrack @@ -54,7 +53,7 @@ class Run(object): class Track(Persistent): - implements(ITrack) + implements(ITrack, IPhysicallyLocatable) metadata_attributes = ('taskId', 'runId', 'userName', 'timeStamp') index_attributes = metadata_attributes @@ -73,6 +72,9 @@ class Track(Persistent): self.timeStamp = getTimeStamp() self.data = data + def getName(self): + return self.__name__ + def update(self, newData): if not newData: return