From dbbd37e63a084528ed1088862ce1a65c22d5cb56 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 24 Aug 2008 11:40:17 +0000 Subject: [PATCH] include langInfo processing for future multilingual extension git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2851 fd906abe-77d9-0310-91a1-e0d9ade77398 --- common.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/common.py b/common.py index a78d247..ca17146 100644 --- a/common.py +++ b/common.py @@ -221,6 +221,8 @@ class ContainerAttribute(object): """ Use objects within a ConceptManager object for a collection attribute. """ + langInfo = None + def __init__(self, context, typeName, idAttr='name', prefix=''): self.context = context self.typeName = typeName @@ -244,16 +246,19 @@ class ContainerAttribute(object): del self.context[self.prefix + id] 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): for c in self.typeConcept.getChildren([self.context.getTypePredicate()]): - yield adapted(c) + yield adapted(c, langInfo=self.langInfo) class RelationSet(object): """ Use relations of a certain predicate for a collection attribute.""" + langInfo = None + def __init__(self, context, predicateName): self.adapted = context if isinstance(context, AdapterBase): @@ -289,7 +294,7 @@ class ParentRelationSet(RelationSet): def __iter__(self): for c in self.context.getParents([self.predicate]): - yield adapted(c) + yield adapted(c, langInfo=self.langInfo) class ChildRelationSet(RelationSet): @@ -306,7 +311,7 @@ class ChildRelationSet(RelationSet): def __iter__(self): for c in self.context.getChildren([self.predicate]): - yield adapted(c) + yield adapted(c, langInfo=self.langInfo) # caching (TBD)