use 'baseObject' function instead of explicitly written check
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3666 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
a14dc3b209
commit
231e2871a1
1 changed files with 14 additions and 11 deletions
23
common.py
23
common.py
|
@ -136,7 +136,8 @@ class AdapterBase(object):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if not isinstance(other, AdapterBase):
|
if not isinstance(other, AdapterBase):
|
||||||
return False
|
return self.context == other
|
||||||
|
#return False
|
||||||
return self.context == other.context
|
return self.context == other.context
|
||||||
|
|
||||||
def getLoopsRoot(self):
|
def getLoopsRoot(self):
|
||||||
|
@ -323,10 +324,11 @@ class RelationSet(object):
|
||||||
|
|
||||||
def __init__(self, context, predicateName, interface=None, noSecurityCheck=False):
|
def __init__(self, context, predicateName, interface=None, noSecurityCheck=False):
|
||||||
self.adapted = context
|
self.adapted = context
|
||||||
if isinstance(context, AdapterBase):
|
self.context = baseObject(context)
|
||||||
self.context = context.context
|
#if isinstance(context, AdapterBase):
|
||||||
else:
|
# self.context = context.context
|
||||||
self.context = context
|
#else:
|
||||||
|
# self.context = context
|
||||||
self.predicateName = predicateName
|
self.predicateName = predicateName
|
||||||
self.interface = interface
|
self.interface = interface
|
||||||
self.noSecurityCheck = noSecurityCheck
|
self.noSecurityCheck = noSecurityCheck
|
||||||
|
@ -347,16 +349,17 @@ class RelationSet(object):
|
||||||
class ParentRelationSet(RelationSet):
|
class ParentRelationSet(RelationSet):
|
||||||
|
|
||||||
def add(self, related, order=0, relevance=1.0):
|
def add(self, related, order=0, relevance=1.0):
|
||||||
if isinstance(related, AdapterBase):
|
#if isinstance(related, AdapterBase):
|
||||||
related = related.context
|
# related = related.context
|
||||||
|
related = baseObject(related)
|
||||||
self.context.deassignParent(related, [self.predicate], # avoid duplicates
|
self.context.deassignParent(related, [self.predicate], # avoid duplicates
|
||||||
noSecurityCheck=self.noSecurityCheck)
|
noSecurityCheck=self.noSecurityCheck)
|
||||||
self.context.assignParent(related, self.predicate, order, relevance)
|
self.context.assignParent(related, self.predicate, order, relevance)
|
||||||
|
|
||||||
def remove(self, related):
|
def remove(self, related):
|
||||||
if isinstance(related, AdapterBase):
|
#if isinstance(related, AdapterBase):
|
||||||
related = related.context
|
# related = related.context
|
||||||
self.context.deassignParent(related, [self.predicate])
|
self.context.deassignParent(baseObject(related), [self.predicate])
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
if self.adapted.__is_dummy__:
|
if self.adapted.__is_dummy__:
|
||||||
|
|
Loading…
Add table
Reference in a new issue