an additional setParents() method for concepts and other minor improvements
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2398 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
13e1aa0a4b
commit
7a1c885fcd
3 changed files with 14 additions and 3 deletions
|
@ -126,6 +126,7 @@ class NodeView(BaseView):
|
|||
if target is not None:
|
||||
basicView = component.getMultiAdapter((target, self.request), name=viewName)
|
||||
# xxx: obsolete when self.targetObject is virtual target:
|
||||
if hasattr(basicView, 'view'):
|
||||
return basicView.view
|
||||
return self.page
|
||||
|
||||
|
@ -325,6 +326,7 @@ class NodeView(BaseView):
|
|||
basicView = component.getMultiAdapter((obj, self.request))
|
||||
if obj == self.targetObject:
|
||||
basicView._viewName = self.context.viewName
|
||||
if hasattr(basicView, 'view'):
|
||||
return basicView.view
|
||||
|
||||
@Lazy
|
||||
|
|
|
@ -217,6 +217,15 @@ class Concept(Contained, Persistent):
|
|||
def assignParent(self, concept, predicate=None, order=0, relevance=1.0):
|
||||
concept.assignChild(self, predicate, order, relevance)
|
||||
|
||||
def setParents(self, predicate, concepts):
|
||||
existing = self.getParents([predicate])
|
||||
for c in existing:
|
||||
if c not in concepts:
|
||||
self.deassignParent(c, [predicate])
|
||||
for c in concepts:
|
||||
if c not in existing:
|
||||
self.assignParent(c, predicate)
|
||||
|
||||
def deassignChild(self, child, predicates=None, order=None):
|
||||
registry = component.getUtility(IRelationRegistry)
|
||||
for rel in self.getChildRelations(predicates, child):
|
||||
|
|
Loading…
Add table
Reference in a new issue