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,7 +126,8 @@ class NodeView(BaseView):
|
|||
if target is not None:
|
||||
basicView = component.getMultiAdapter((target, self.request), name=viewName)
|
||||
# xxx: obsolete when self.targetObject is virtual target:
|
||||
return basicView.view
|
||||
if hasattr(basicView, 'view'):
|
||||
return basicView.view
|
||||
return self.page
|
||||
|
||||
@Lazy
|
||||
|
@ -325,7 +326,8 @@ class NodeView(BaseView):
|
|||
basicView = component.getMultiAdapter((obj, self.request))
|
||||
if obj == self.targetObject:
|
||||
basicView._viewName = self.context.viewName
|
||||
return basicView.view
|
||||
if hasattr(basicView, 'view'):
|
||||
return basicView.view
|
||||
|
||||
@Lazy
|
||||
def targetId(self):
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -133,7 +133,7 @@ class TestSite(object):
|
|||
component.provideAdapter(NoteSchemaFactory)
|
||||
|
||||
component.provideAdapter(Controller, (Interface, IBrowserRequest),
|
||||
IBrowserView, name='controller')
|
||||
IBrowserView, name='controller')
|
||||
component.provideAdapter(MemberInfoProvider,
|
||||
(ILoopsObject, IBrowserRequest))
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue