@subscriber(ResourceChanged, for_resources=('collection',), for_actions=(ACTIONS.DELETE,))
def on_collections_deleted(event):
 storage = event.request.registry.storage
 permission = event.request.registry.permission
 for change in event.impacted_records:
  collection = change['old']
  bucket_id = event.payload['bucket_id']
  parent_id = utils.instance_uri(event.request, 'collection', bucket_id=bucket_id, id=collection['id'])
  storage.delete_all(collection_id='record', parent_id=parent_id, with_deleted=False)
  storage.purge_deleted(collection_id='record', parent_id=parent_id)
  permission.delete_object_permissions((parent_id + '*'))

@ subscriber ( ResourceChanged , for_resources = ( 'collection' , ) , for_actions = ( ACTIONS . DELETE , ) ) def on_collections_deleted ( event ) : storage = event . request . registry . storage permission = event . request . registry . permission for change in event . impacted_records : collection = change [ 'old' ] bucket_id = event . payload [ 'bucket_id' ] parent_id = utils . instance_uri ( event . request , 'collection' , bucket_id = bucket_id , id = collection [ 'id' ] ) storage . delete_all ( collection_id = 'record' , parent_id = parent_id , with_deleted = False ) storage . purge_deleted ( collection_id = 'record' , parent_id = parent_id ) permission . delete_object_permissions ( ( parent_id + '*' ) )
some collections were deleted .