work in progress: task management with work items
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3093 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									7db5c8df68
								
							
						
					
					
						commit
						0fd3b8d78d
					
				
					 2 changed files with 9 additions and 12 deletions
				
			
		|  | @ -73,7 +73,7 @@ the work items we have to provide an adapter to the tracking storage. | |||
| 
 | ||||
|   >>> from cybertools.tracking.btree import TrackingStorage | ||||
|   >>> from cybertools.organize.interfaces import IWorkItems | ||||
|   >>> from cybertools.organize.work import WorkItemTrack, WorkItems | ||||
|   >>> from cybertools.organize.work import WorkItem, WorkItems | ||||
|   >>> component.provideAdapter(WorkItems) | ||||
| 
 | ||||
| The individual work item (a track) is carrying a state attribute that is | ||||
|  | @ -85,7 +85,7 @@ definition as a utility. | |||
| 
 | ||||
| We are now ready to set up the tracking storage. | ||||
| 
 | ||||
|   >>> tracks = TrackingStorage(trackFactory=WorkItemTrack) | ||||
|   >>> tracks = TrackingStorage(trackFactory=WorkItem) | ||||
|   >>> workItems = component.getAdapter(tracks, IWorkItems) | ||||
| 
 | ||||
| The work management only deals with the IDs or names of tasks and persons, | ||||
|  |  | |||
|  | @ -60,20 +60,14 @@ def workItemStates(): | |||
|         initialState='new') | ||||
| 
 | ||||
| 
 | ||||
| class WorkItem(Stateful): | ||||
| class WorkItem(Stateful, Track): | ||||
|     """ A work item that may be stored as a track in a tracking storage. | ||||
|     """ | ||||
| 
 | ||||
|     implements(IWorkItem) | ||||
| 
 | ||||
|     statesDefinition = 'organize.workItemStates' | ||||
| 
 | ||||
|     def getStatesDefinition(self): | ||||
|         return component.getUtility(IStatesDefinition, name=self.statesDefinition) | ||||
| 
 | ||||
| 
 | ||||
| class WorkItemTrack(WorkItem, Track): | ||||
|     """ A work item that may be stored as a track in a tracking storage. | ||||
|     """ | ||||
| 
 | ||||
|     metadata_attributes = Track.metadata_attributes + ('state',) | ||||
|     index_attributes = metadata_attributes | ||||
|     typeName = 'WorkItem' | ||||
|  | @ -84,7 +78,7 @@ class WorkItemTrack(WorkItem, Track): | |||
|     closeAttributes = set(['end', 'duration', 'effort', 'comment']) | ||||
| 
 | ||||
|     def __init__(self, taskId, runId, userName, data): | ||||
|         super(WorkItemTrack, self).__init__(taskId, runId, userName, data) | ||||
|         super(WorkItem, self).__init__(taskId, runId, userName, data) | ||||
|         self.state = self.getState()    # make initial state persistent | ||||
|         self.data['creator'] = userName | ||||
|         self.data['created'] = self.timeStamp | ||||
|  | @ -94,6 +88,9 @@ class WorkItemTrack(WorkItem, Track): | |||
|             raise AttributeError(attr) | ||||
|         return self.data.get(attr, None) | ||||
| 
 | ||||
|     def getStatesDefinition(self): | ||||
|         return component.getUtility(IStatesDefinition, name=self.statesDefinition) | ||||
| 
 | ||||
|     @property | ||||
|     def party(self): | ||||
|         return self.userName | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm