Commit edb86bc0 authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[server] Use dict.setdefault() instead of if/else in repo.glob_add_relations()

parent 19aae64c4010
...@@ -923,10 +923,7 @@ class Repository(object): ...@@ -923,10 +923,7 @@ class Repository(object):
for subjeid, objeid in eids_subj_obj: for subjeid, objeid in eids_subj_obj:
print('ADD relation', subjeid, rtype, objeid) print('ADD relation', subjeid, rtype, objeid)
for subjeid, objeid in eids_subj_obj: for subjeid, objeid in eids_subj_obj:
if rtype in relations_by_rtype: relations_by_rtype.setdefault(rtype, []).append((subjeid, objeid))
relations_by_rtype[rtype].append((subjeid, objeid))
else:
relations_by_rtype[rtype] = [(subjeid, objeid)]
if not activintegrity: if not activintegrity:
continue continue
# take care to relation of cardinality '?1', as all eids will # take care to relation of cardinality '?1', as all eids will
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment