943 continue |
943 continue |
944 var = '%s%s' % (rtype.upper(), x.upper()) |
944 var = '%s%s' % (rtype.upper(), x.upper()) |
945 if x == 'subject': |
945 if x == 'subject': |
946 # don't skip inlined relation so they are regularly |
946 # don't skip inlined relation so they are regularly |
947 # deleted and so hooks are correctly called |
947 # deleted and so hooks are correctly called |
948 rql.append('X %s %s' % (rtype, var)) |
948 selection = 'X %s %s' % (rtype, var) |
949 else: |
949 else: |
950 rql.append('%s %s X' % (var, rtype)) |
950 selection = '%s %s X' % (var, rtype) |
951 rql = 'DELETE %s WHERE X eid %%(x)s' % ','.join(rql) |
951 rql = 'DELETE %s WHERE X eid %%(x)s' % selection |
952 # unsafe_execute since we suppose that if user can delete the entity, |
952 # unsafe_execute since we suppose that if user can delete the entity, |
953 # he can delete all its relations without security checking |
953 # he can delete all its relations without security checking |
954 session.unsafe_execute(rql, {'x': eid}, 'x', build_descr=False) |
954 session.unsafe_execute(rql, {'x': eid}, 'x', build_descr=False) |
955 |
955 |
956 def index_entity(self, session, entity): |
956 def index_entity(self, session, entity): |
957 """full text index a modified entity""" |
957 """full text index a modified entity""" |
958 alreadydone = session.transaction_data.setdefault('indexedeids', set()) |
958 alreadydone = session.transaction_data.setdefault('indexedeids', set()) |
959 if entity.eid in alreadydone: |
959 if entity.eid in alreadydone: |