appy.gen: added method wrapper.search1 that returns a single result (which is the only difference with wrapper.search); bugfix while getting objects from the catalog (bypass security when called from code).
This commit is contained in:
		
							parent
							
								
									cb53c6b9b2
								
							
						
					
					
						commit
						0b6d2d2165
					
				
					 5 changed files with 17 additions and 11 deletions
				
			
		|  | @ -244,6 +244,11 @@ class AbstractWrapper(object): | |||
|                                 maxResults=maxResults, noSecurity=noSecurity) | ||||
|         return [o.appy() for o in res['objects']] | ||||
| 
 | ||||
|     def search1(self, *args, **kwargs): | ||||
|         '''Identical to m_search above, but returns a single result (if any).''' | ||||
|         res = self.search(*args, **kwargs) | ||||
|         if res: return res[0] | ||||
| 
 | ||||
|     def count(self, klass, noSecurity=False, **fields): | ||||
|         '''Identical to m_search above, but returns the number of objects that | ||||
|            match the search instead of returning the objects themselves. Use | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Gaetan Delannay
						Gaetan Delannay