delete relations one by one to avoid too complex rql analysis
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 07 Aug 2009 13:59:18 +0200
changeset 2731 815b93271338
parent 2730 bb6fcb8c5d71
child 2732 c28b5f16f3af
delete relations one by one to avoid too complex rql analysis
server/repository.py
--- a/server/repository.py	Fri Aug 07 13:58:28 2009 +0200
+++ b/server/repository.py	Fri Aug 07 13:59:18 2009 +0200
@@ -945,13 +945,13 @@
             if x == 'subject':
                 # don't skip inlined relation so they are regularly
                 # deleted and so hooks are correctly called
-                rql.append('X %s %s' % (rtype, var))
+                selection = 'X %s %s' % (rtype, var)
             else:
-                rql.append('%s %s X' % (var, rtype))
-        rql = 'DELETE %s WHERE X eid %%(x)s' % ','.join(rql)
-        # unsafe_execute since we suppose that if user can delete the entity,
-        # he can delete all its relations without security checking
-        session.unsafe_execute(rql, {'x': eid}, 'x', build_descr=False)
+                selection = '%s %s X' % (var, rtype)
+            rql = 'DELETE %s WHERE X eid %%(x)s' % selection
+            # unsafe_execute since we suppose that if user can delete the entity,
+            # he can delete all its relations without security checking
+            session.unsafe_execute(rql, {'x': eid}, 'x', build_descr=False)
 
     def index_entity(self, session, entity):
         """full text index a modified entity"""