Commit 27cb9835 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[repo] misc cleanup

--HG--
branch : stable
parent 9d641d98cc86
......@@ -1039,9 +1039,9 @@ class Repository(object):
# call hooks for inlined relations
for attr, value in relations:
self.hm.call_hooks('before_add_relation', attr, session,
entity.eid, attr, value)
entity.eid, attr, value)
self.hm.call_hooks('after_add_relation', attr, session,
entity.eid, attr, value)
entity.eid, attr, value)
return entity.eid
def glob_update_entity(self, session, entity, edited_attributes):
......@@ -1058,7 +1058,7 @@ class Repository(object):
session.set_entity_cache(entity)
only_inline_rels, need_fti_update = True, False
relations = []
for attr in entity.keys():
for attr in edited_attributes:
if attr == 'eid':
continue
rschema = eschema.subject_relation(attr)
......@@ -1068,8 +1068,8 @@ class Repository(object):
only_inline_rels = False
else:
# inlined relation
previous_value = entity.related(attr)
if previous_value:
previous_value = entity.related(attr) or None
if previous_value is not None:
previous_value = previous_value[0][0] # got a result set
if previous_value == entity[attr]:
previous_value = None
......@@ -1100,7 +1100,7 @@ class Repository(object):
for attr, value, prevvalue in relations:
# if the relation is already cached, update existant cache
relcache = entity.relation_cached(attr, 'subject')
if prevvalue:
if prevvalue is not None:
self.hm.call_hooks('after_delete_relation', attr, session,
entity.eid, attr, prevvalue)
if relcache is not None:
......
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