include langInfo processing for future multilingual extension
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2851 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									35dceda12f
								
							
						
					
					
						commit
						dbbd37e63a
					
				
					 1 changed files with 9 additions and 4 deletions
				
			
		
							
								
								
									
										13
									
								
								common.py
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								common.py
									
										
									
									
									
								
							|  | @ -221,6 +221,8 @@ class ContainerAttribute(object): | ||||||
|     """ Use objects within a ConceptManager object for a collection attribute. |     """ Use objects within a ConceptManager object for a collection attribute. | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|  |     langInfo = None | ||||||
|  | 
 | ||||||
|     def __init__(self, context, typeName, idAttr='name', prefix=''): |     def __init__(self, context, typeName, idAttr='name', prefix=''): | ||||||
|         self.context = context |         self.context = context | ||||||
|         self.typeName = typeName |         self.typeName = typeName | ||||||
|  | @ -244,16 +246,19 @@ class ContainerAttribute(object): | ||||||
|         del self.context[self.prefix + id] |         del self.context[self.prefix + id] | ||||||
| 
 | 
 | ||||||
|     def get(self, id, default=None, langInfo=None): |     def get(self, id, default=None, langInfo=None): | ||||||
|         return adapted(self.context.get(self.prefix + id, default), langInfo=langInfo) |         return adapted(self.context.get(self.prefix + id, default), | ||||||
|  |                        langInfo=self.langInfo) | ||||||
| 
 | 
 | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         for c in self.typeConcept.getChildren([self.context.getTypePredicate()]): |         for c in self.typeConcept.getChildren([self.context.getTypePredicate()]): | ||||||
|             yield adapted(c) |             yield adapted(c, langInfo=self.langInfo) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class RelationSet(object): | class RelationSet(object): | ||||||
|     """ Use relations of a certain predicate for a collection attribute.""" |     """ Use relations of a certain predicate for a collection attribute.""" | ||||||
| 
 | 
 | ||||||
|  |     langInfo = None | ||||||
|  | 
 | ||||||
|     def __init__(self, context, predicateName): |     def __init__(self, context, predicateName): | ||||||
|         self.adapted = context |         self.adapted = context | ||||||
|         if isinstance(context, AdapterBase): |         if isinstance(context, AdapterBase): | ||||||
|  | @ -289,7 +294,7 @@ class ParentRelationSet(RelationSet): | ||||||
| 
 | 
 | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         for c in self.context.getParents([self.predicate]): |         for c in self.context.getParents([self.predicate]): | ||||||
|             yield adapted(c) |             yield adapted(c, langInfo=self.langInfo) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class ChildRelationSet(RelationSet): | class ChildRelationSet(RelationSet): | ||||||
|  | @ -306,7 +311,7 @@ class ChildRelationSet(RelationSet): | ||||||
| 
 | 
 | ||||||
|     def __iter__(self): |     def __iter__(self): | ||||||
|         for c in self.context.getChildren([self.predicate]): |         for c in self.context.getChildren([self.predicate]): | ||||||
|             yield adapted(c) |             yield adapted(c, langInfo=self.langInfo) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| # caching (TBD) | # caching (TBD) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm