def chained_delete(chained, id, delete=None, contains=op.contains):
stores_with_delete = [s for s in chained.stores if s._delete]
if len(stores_with_delete) == 0:
raise PermissionError('delete', chained, 'delete')
foundin = []
for store in stores_with_delete:
if contains(store, id):
foundin.append(store)
if delete:
delete(store, id)
else:
store.delete(id)
if len(foundin) == 0:
raise KeyError(id, chained)
else:
return foundin
评论列表
文章目录