performance improvement: only create new relation if necessary, simplified
This commit is contained in:
parent
c6638e7b5e
commit
02e07c0e85
1 changed files with 6 additions and 5 deletions
11
common.py
11
common.py
|
@ -482,13 +482,14 @@ class ParentRelation(object):
|
|||
return None
|
||||
|
||||
def __set__(self, inst, value):
|
||||
s = ParentRelationSet(inst, self.predicateName)
|
||||
for current in s:
|
||||
rs = ParentRelationSet(inst, self.predicateName)
|
||||
rsList = list(rs)
|
||||
for current in rsList:
|
||||
if current != value:
|
||||
s.remove(current)
|
||||
rs.remove(current)
|
||||
if value is not None:
|
||||
if value not in s:
|
||||
s.add(value) # how to supply additional parameters?
|
||||
if value not in rsList:
|
||||
rs.add(value) # how to supply additional parameters?
|
||||
|
||||
|
||||
# caching (TBD)
|
||||
|
|
Loading…
Add table
Reference in a new issue