@subscriber(ResourceChanged, for_resources=('bucket',), for_actions=(ACTIONS.DELETE,))
def on_buckets_deleted(event):
 storage = event.request.registry.storage
 permission = event.request.registry.permission
 for change in event.impacted_records:
  bucket = change['old']
  bucket_uri = instance_uri(event.request, 'bucket', id=bucket['id'])
  parent_pattern = (bucket_uri + '*')
  storage.delete_all(parent_id=parent_pattern, collection_id=None, with_deleted=False)
  storage.purge_deleted(parent_id=parent_pattern, collection_id=None)
  permission.delete_object_permissions(parent_pattern)

@ subscriber ( ResourceChanged , for_resources = ( 'bucket' , ) , for_actions = ( ACTIONS . DELETE , ) ) def on_buckets_deleted ( event ) : storage = event . request . registry . storage permission = event . request . registry . permission for change in event . impacted_records : bucket = change [ 'old' ] bucket_uri = instance_uri ( event . request , 'bucket' , id = bucket [ 'id' ] ) parent_pattern = ( bucket_uri + '*' ) storage . delete_all ( parent_id = parent_pattern , collection_id = None , with_deleted = False ) storage . purge_deleted ( parent_id = parent_pattern , collection_id = None ) permission . delete_object_permissions ( parent_pattern )
some buckets were deleted .