work in progress: view work items
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3099 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									42f9529086
								
							
						
					
					
						commit
						3530b7045a
					
				
					 2 changed files with 23 additions and 0 deletions
				
			
		|  | @ -493,7 +493,21 @@ class IWorkItems(Interface): | ||||||
|     """ A collection (manager, container) of work items. |     """ 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): |     def add(task, party, run=0, **kw): | ||||||
|         """ Create and register a work item; return it. Additional properties |         """ Create and register a work item; return it. Additional properties | ||||||
|             may be specified via keyword arguments. |             may be specified via keyword arguments. | ||||||
|         """ |         """ | ||||||
|  | 
 | ||||||
|  |  | ||||||
|  | @ -228,6 +228,15 @@ class WorkItems(object): | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         return iter(self.context.values()) |         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): |     def add(self, task, party, run=0, **kw): | ||||||
|         trackId = self.context.saveUserTrack(task, run, party, {}) |         trackId = self.context.saveUserTrack(task, run, party, {}) | ||||||
|         track = self[trackId] |         track = self[trackId] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm