hooks/integrity.py
changeset 3589 a5432f99f2d9
parent 3376 f5c69485381f
child 3590 1b0dbcf4b214
--- a/hooks/integrity.py	Wed Sep 30 18:57:42 2009 +0200
+++ b/hooks/integrity.py	Wed Oct 07 12:31:08 2009 +0200
@@ -198,6 +198,11 @@
     events = ('before_delete_relation',)
 
     def __call__(self):
+        # if the relation is being delete, don't delete composite's components
+        # automatically
+        pendingrdefs = self._cw.transaction_data.get('pendingrdefs', ())
+        if (self._cw.describe(eidfrom)[0], rtype, self._cw.describe(eidto)[0]) in pendingrdefs:
+            return
         composite = self._cw.schema_rproperty(self.rtype, self.eidfrom, self.eidto,
                                                  'composite')
         if composite == 'subject':