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
|
return None
|
||||||
|
|
||||||
def __set__(self, inst, value):
|
def __set__(self, inst, value):
|
||||||
s = ParentRelationSet(inst, self.predicateName)
|
rs = ParentRelationSet(inst, self.predicateName)
|
||||||
for current in s:
|
rsList = list(rs)
|
||||||
|
for current in rsList:
|
||||||
if current != value:
|
if current != value:
|
||||||
s.remove(current)
|
rs.remove(current)
|
||||||
if value is not None:
|
if value is not None:
|
||||||
if value not in s:
|
if value not in rsList:
|
||||||
s.add(value) # how to supply additional parameters?
|
rs.add(value) # how to supply additional parameters?
|
||||||
|
|
||||||
|
|
||||||
# caching (TBD)
|
# caching (TBD)
|
||||||
|
|
Loading…
Add table
Reference in a new issue